diff --git a/includes/animations.h b/includes/animations.h index 6a6071f..18fa775 100644 --- a/includes/animations.h +++ b/includes/animations.h @@ -11,6 +11,9 @@ extern GLuint _dims[]; // Scène de manifestation void manif(int); +// Scène du tag sur le mur +void tag(int); + // Crédits de fin void credits(int); diff --git a/main.c b/main.c index 2318fe4..c10946e 100644 --- a/main.c +++ b/main.c @@ -20,9 +20,11 @@ int main(int argc, char *argv[]) { } // Animations - GL4DHanime animations[] = {{10000, manif, NULL, NULL}, - {2000, manif, credits, zoom_in}, - {9500, credits, NULL, NULL}, + GL4DHanime animations[] = {{10000, manif, NULL, NULL}, // Manifestation + {2000, manif, tag, zoom_in}, // Transition + {2000, tag, NULL, NULL}, // Tag + {2000, tag, credits, zoom_in}, // Transition + {9500, credits, NULL, NULL}, // Crédits {0, NULL, NULL, NULL}}; gl4dhInit(animations, _dims[0], _dims[1], init); diff --git a/shaders/tag.fs b/shaders/tag.fs new file mode 100644 index 0000000..b738ab3 --- /dev/null +++ b/shaders/tag.fs @@ -0,0 +1,4 @@ +#version 330 + +void main() { +} diff --git a/shaders/tag.vs b/shaders/tag.vs new file mode 100644 index 0000000..b738ab3 --- /dev/null +++ b/shaders/tag.vs @@ -0,0 +1,4 @@ +#version 330 + +void main() { +} diff --git a/src/manif.c b/src/manif.c index 07e439c..5f20f2d 100644 --- a/src/manif.c +++ b/src/manif.c @@ -61,14 +61,13 @@ static void init(void) { gl4duGenMatrix(GL_FLOAT, matrix_proj); gl4duGenMatrix(GL_FLOAT, matrix_model); gl4duGenMatrix(GL_FLOAT, matrix_view); - - glEnable(GL_DEPTH_TEST); } static void draw(void) { static double t0 = 0; double dt = get_dt(&t0, GL_TRUE); + glEnable(GL_DEPTH_TEST); glClearColor(0.2f, 0.2f, 0.8f, 1); // couleur ciel glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(_pId); diff --git a/src/tag.c b/src/tag.c new file mode 100644 index 0000000..0ec10c2 --- /dev/null +++ b/src/tag.c @@ -0,0 +1,34 @@ +#include "../includes/animations.h" + +static GLuint _pId = 0; + +static void init(void); +static void draw(void); + +void tag(int state) { + switch (state) { + case GL4DH_INIT: + init(); + break; + + case GL4DH_DRAW: + draw(); + break; + + default: + break; + } +} + +static void init(void) { + _pId = gl4duCreateProgram("shaders/tag.vs", "shaders/tag.fs", NULL); +} + +static void draw(void) { + glEnable(GL_DEPTH_TEST); + glClearColor(0.2f, 0.2f, 0.2f, 1); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glUseProgram(_pId); + + glUseProgram(0); +}