From f3442af96194667ae5aee220f253ce2bb020b0af Mon Sep 17 00:00:00 2001 From: Gothor Date: Mon, 29 May 2023 22:24:02 +0200 Subject: [PATCH] add resize function to anime manager --- lib_src/GL4D/gl4dhAnimeManager.c | 15 +++++++++++++++ lib_src/GL4D/gl4dhAnimeManager.h | 1 + 2 files changed, 16 insertions(+) diff --git a/lib_src/GL4D/gl4dhAnimeManager.c b/lib_src/GL4D/gl4dhAnimeManager.c index 68bf58a..92b9828 100644 --- a/lib_src/GL4D/gl4dhAnimeManager.c +++ b/lib_src/GL4D/gl4dhAnimeManager.c @@ -133,6 +133,21 @@ void gl4dhUpdateWithAudio(void) { drawOrUpdateWithAudio(_animations, GL4DH_UPDATE_WITH_AUDIO); } +/*!\brief met à jour la largeur et la hauteur de la texture dans laquelle sont + * réalisées les animations. + */ +void gl4dhResize(int w, int h) { + _w = w; _h = h; + + glBindTexture(GL_TEXTURE_2D, _wTexId); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + + glBindTexture(GL_TEXTURE_2D, _wdTexId); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, w, h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); + + glBindTexture(GL_TEXTURE_2D, 0); +} + /*!\brief regarde si le pointeur \a func est un élément du tableau * \a funcList * \param func un élément dont il faut tester la présence. diff --git a/lib_src/GL4D/gl4dhAnimeManager.h b/lib_src/GL4D/gl4dhAnimeManager.h index e0cbed7..b5d14d3 100644 --- a/lib_src/GL4D/gl4dhAnimeManager.h +++ b/lib_src/GL4D/gl4dhAnimeManager.h @@ -37,6 +37,7 @@ extern "C" { GL4DAPI Uint32 GL4DAPIENTRY gl4dhGetTicks(void); GL4DAPI void GL4DAPIENTRY gl4dhDraw(void); GL4DAPI void GL4DAPIENTRY gl4dhUpdateWithAudio(void); + GL4DAPI void GL4DAPIENTRY gl4dhResize(int w, int h); #ifdef __cplusplus }