initialisation global of quad

This commit is contained in:
Mylloon 2023-05-19 12:30:47 +02:00
parent d7036e5b79
commit 2317ee328e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 13 additions and 1 deletions

View file

@ -14,6 +14,9 @@ void manif(int);
// Crédits de fin // Crédits de fin
void credits(int); void credits(int);
// Initialisation des transitions
void transitions_init(void);
// Transition zoom // Transition zoom
void zoom_in(void (*)(int), void (*)(int), Uint32, Uint32, int); void zoom_in(void (*)(int), void (*)(int), Uint32, Uint32, int);

2
main.c
View file

@ -42,6 +42,8 @@ static void init(void) {
srand((Uint32)time(NULL)); srand((Uint32)time(NULL));
transitions_init();
printf("Bienvenue dans la démo API8 !\n"); printf("Bienvenue dans la démo API8 !\n");
} }

View file

@ -3,7 +3,7 @@
/* Mise-à-jour des animations en fonction du son */ /* Mise-à-jour des animations en fonction du son */
static void update_with_audio(void (*)(int), void (*)(int), int); static void update_with_audio(void (*)(int), void (*)(int), int);
static GLuint _zoomin_pId = 0, _zoomin_tId = 0, _zoomin_tex[2]; static GLuint _zoomin_pId = 0, _zoomin_tId = 0, _zoomin_tex[2], _quadId = 0;
static void zoomin_init(void); static void zoomin_init(void);
static void zoomin_draw(void (*)(int), void (*)(int), Uint32, Uint32, int); static void zoomin_draw(void (*)(int), void (*)(int), Uint32, Uint32, int);
static void zoomin_deinit(void); static void zoomin_deinit(void);
@ -18,6 +18,12 @@ static void update_with_audio(void (*a0)(int), void (*a1)(int), int state) {
} }
} }
void transitions_init(void) {
if (!_quadId) {
_quadId = gl4dgGenQuadf();
}
}
void zoom_in(void (*a0)(int), void (*a1)(int), Uint32 t, Uint32 et, int state) { void zoom_in(void (*a0)(int), void (*a1)(int), Uint32 t, Uint32 et, int state) {
switch (state) { switch (state) {
case GL4DH_INIT: case GL4DH_INIT:
@ -82,6 +88,7 @@ static void zoomin_draw(void (*a0)(int), void (*a1)(int), Uint32 t, Uint32 et,
glUniform1f(glGetUniformLocation(_zoomin_pId, "zoomAmount"), glUniform1f(glGetUniformLocation(_zoomin_pId, "zoomAmount"),
(GLfloat)et / (GLfloat)t); (GLfloat)et / (GLfloat)t);
glUniform1i(glGetUniformLocation(_zoomin_pId, "tex"), 0); glUniform1i(glGetUniformLocation(_zoomin_pId, "tex"), 0);
gl4dgDraw(_quadId);
} }
static void zoomin_deinit(void) { static void zoomin_deinit(void) {