GL4Dummies  0.1.7
Référence du fichier gl4dhAnimeManager.h

Bibliothèque de gestion des écrans d'animation et de mises à jour en fonction du son. Plus de détails...

#include "gl4du.h"
Graphe des dépendances par inclusion de gl4dhAnimeManager.h:
Ce graphe montre quels fichiers incluent directement ou indirectement ce fichier :

Aller au code source de ce fichier.

Structures de données

struct  GL4DHanime
 

Définitions de type

typedef struct GL4DHanime GL4DHanime
 

Énumérations

enum  GL4DHstate { GL4DH_INIT, GL4DH_UPDATE_WITH_AUDIO, GL4DH_DRAW, GL4DH_FREE }
 

Fonctions

GL4DAPI void GL4DAPIENTRY gl4dhInit (GL4DHanime *animations, int w, int h, void(*callBeforeAllAnimationsInit)(void))
 Demande l'état initialisation à tous les éléments du tableau d'animations. Plus de détails...
 
GL4DAPI void GL4DAPIENTRY gl4dhClean (void)
 demande l'état libération à tous les éléments du tableau d'animations. Plus de détails...
 
GL4DAPI void GL4DAPIENTRY gl4dhStartingSignal (void)
 donne le top-départ de la démo. Cette fonction doit être appelée juste avant le début de la boucle infinie d'affichage (soit juste avant le premier GL4DH_DRAW obtenu en appelant gl4dhDraw). Plus de détails...
 
GL4DAPI Uint32 GL4DAPIENTRY gl4dhGetTicks (void)
 renvoie le nombre de milisecondes passée depuis le top-départ donné par gl4dhStartingSignal. Plus de détails...
 
GL4DAPI void GL4DAPIENTRY gl4dhDraw (void)
 joue parmi les animations passées en argument l'animation en cours (devant être jouée au temps t). Plus de détails...
 
GL4DAPI void GL4DAPIENTRY gl4dhUpdateWithAudio (void)
 met à jour parmi les animations passées en argument l'animation en cours. Plus de détails...
 

Description détaillée

Bibliothèque de gestion des écrans d'animation et de mises à jour en fonction du son.

Auteur
Farès BELHADJ, amsi@.nosp@m.ai.u.nosp@m.niv-p.nosp@m.aris.nosp@m.8.fr
Date
April 29 2014

Définition dans le fichier gl4dhAnimeManager.h.

Documentation des définitions de type

◆ GL4DHanime

typedef struct GL4DHanime GL4DHanime

Documentation du type de l'énumération

◆ GL4DHstate

enum GL4DHstate
Valeurs énumérées
GL4DH_INIT 
GL4DH_UPDATE_WITH_AUDIO 
GL4DH_DRAW 
GL4DH_FREE 
20  {
21  GL4DH_INIT,
23  GL4DH_DRAW,
25  };

Documentation des fonctions

◆ gl4dhClean()

GL4DAPI void GL4DAPIENTRY gl4dhClean ( void  )

demande l'état libération à tous les éléments du tableau d'animations.

76  {
77  if(_animations) {
79  _animations = NULL;
80  }
81  if(_wTexId) {
82  glDeleteTextures(1, &_wTexId);
83  _wTexId = 0;
84  }
85  if(_wdTexId) {
86  glDeleteTextures(1, &_wdTexId);
87  _wdTexId = 0;
88  }
89  if(_fbo) {
90  glDeleteFramebuffers(1, &_fbo);
91  _fbo = 0;
92  }
93 }

Références _animations, _fbo, _wdTexId, _wTexId, callAllWithState(), et GL4DH_FREE.

Référencé par gl4duClean().

◆ gl4dhDraw()

GL4DAPI void GL4DAPIENTRY gl4dhDraw ( void  )

joue parmi les animations passées en argument l'animation en cours (devant être jouée au temps t).

113  {
114  int vp[4];
115  glGetIntegerv(GL_VIEWPORT, vp);
116  glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
117  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _wTexId, 0);
119 
120  glUseProgram(0);
121 
122  glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
123  glBlitFramebuffer(0, 0, _w, _h, vp[0], vp[1], vp[0] + vp[2], vp[1] + vp[3], GL_COLOR_BUFFER_BIT, GL_LINEAR);
124  glBlitFramebuffer(0, 0, _w, _h, vp[0], vp[1], vp[0] + vp[2], vp[1] + vp[3], GL_DEPTH_BUFFER_BIT, GL_NEAREST);
125  glBindFramebuffer(GL_FRAMEBUFFER, 0);
126 
127 }

Références _animations, _fbo, _h, _w, _wTexId, drawOrUpdateWithAudio(), et GL4DH_DRAW.

◆ gl4dhGetTicks()

GL4DAPI Uint32 GL4DAPIENTRY gl4dhGetTicks ( void  )

renvoie le nombre de milisecondes passée depuis le top-départ donné par gl4dhStartingSignal.

106  {
107  return SDL_GetTicks() - _startingTime;
108 }

Références _startingTime.

Référencé par drawOrUpdateWithAudio().

◆ gl4dhInit()

GL4DAPI void GL4DAPIENTRY gl4dhInit ( GL4DHanime animations,
int  w,
int  h,
void(*)(void)  callBeforeAllAnimationsInit 
)

Demande l'état initialisation à tous les éléments du tableau d'animations.

Paramètres
animationstableau d'animations se terminant par un élément dont le champ first est à NULL.
wlargeur de la texture dans laquelle sont réalisées les animations.
hhauteur de la texture dans laquelle sont réalisées les animations.
callBeforeAllAnimationsInitfonction à appeler avant le lancement des inits d'animations. Ce paramètre peut-etre NULL si rien n'est fait avant.
42  {
43  _animations = animations;
44  _w = w; _h = h;
45  if(!_fbo)
46  glGenFramebuffers(1, &_fbo);
47  if(!_wTexId)
48  glGenTextures(1, &_wTexId);
49  glBindTexture(GL_TEXTURE_2D, _wTexId);
50  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
51  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
52  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
53  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
54  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
55  if(!_wdTexId)
56  glGenTextures(1, &_wdTexId);
57  glBindTexture(GL_TEXTURE_2D, _wdTexId);
58  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
59  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
60  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
61  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
62  glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, w, h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
63  glBindTexture(GL_TEXTURE_2D, 0);
64 
65  glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
66  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _wTexId, 0);
67  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _wdTexId, 0);
68  if(callBeforeAllAnimationsInit)
69  callBeforeAllAnimationsInit();
71  glBindFramebuffer(GL_FRAMEBUFFER, 0);
72 }

Références _animations, _fbo, _h, _w, _wdTexId, _wTexId, callAllWithState(), et GL4DH_INIT.

◆ gl4dhStartingSignal()

GL4DAPI void GL4DAPIENTRY gl4dhStartingSignal ( void  )

donne le top-départ de la démo. Cette fonction doit être appelée juste avant le début de la boucle infinie d'affichage (soit juste avant le premier GL4DH_DRAW obtenu en appelant gl4dhDraw).

99  {
100  _startingTime = SDL_GetTicks();
101 }

Références _startingTime.

◆ gl4dhUpdateWithAudio()

GL4DAPI void GL4DAPIENTRY gl4dhUpdateWithAudio ( void  )

met à jour parmi les animations passées en argument l'animation en cours.

Références _animations, drawOrUpdateWithAudio(), et GL4DH_UPDATE_WITH_AUDIO.

_wdTexId
static GLuint _wdTexId
Definition: gl4dhAnimeManager.c:29
GL4DH_FREE
@ GL4DH_FREE
Definition: gl4dhAnimeManager.h:24
drawOrUpdateWithAudio
static void drawOrUpdateWithAudio(GL4DHanime *animations, int state)
joue ou met à jour parmi les animations passées en argument l'animation en cours (devant être jouée/m...
Definition: gl4dhAnimeManager.c:206
GL4DH_DRAW
@ GL4DH_DRAW
Definition: gl4dhAnimeManager.h:23
_h
static int _h
Definition: gl4dhAnimeManager.c:32
_fbo
static GLuint _fbo
identifiant du framebuffer utilisé pour dessiner les animations
Definition: gl4dhAnimeManager.c:25
_startingTime
static Uint32 _startingTime
Definition: gl4dhAnimeManager.c:17
_wTexId
static GLuint _wTexId
identifiant de la texture liée en écriture au framebuffer _fbo (la texture dans laquelle les animatio...
Definition: gl4dhAnimeManager.c:29
callAllWithState
static void callAllWithState(GL4DHanime *animations, int state)
Parcourt un tableau d'animations (possiblement dupliquées) et les appelle une et une seule fois avec ...
Definition: gl4dhAnimeManager.c:175
_animations
static GL4DHanime * _animations
pointeur vers le tableau d'animations passé à l'init avec gl4dhInit
Definition: gl4dhAnimeManager.c:21
GL4DH_INIT
@ GL4DH_INIT
Definition: gl4dhAnimeManager.h:21
_w
static int _w
largeur et hauteur de la texture _wTexId liée en écriture au framebuffer _fbo
Definition: gl4dhAnimeManager.c:32
GL4DH_UPDATE_WITH_AUDIO
@ GL4DH_UPDATE_WITH_AUDIO
Definition: gl4dhAnimeManager.h:22