Bonjour, dans mon code mon carré et mon triangle bouge via la gestion du clavier et en passant avec la souris sur le cadre mais je cherche a faire tourner mes formes toute seul automatiquement quoi, je pensais à mettre l'incrémentation dans une boucle mais sans succes .. si vous pouviez m'aider merci !!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
 
int main(int argc, char *argv[])
{
    SDL_Init(SDL_INIT_VIDEO);
    SDL_WM_SetCaption("Mon premier programme OpenGL !",NULL);
    SDL_SetVideoMode(640, 480, 32, SDL_OPENGL);
    int rot=0;
    int continuer = 1;
    SDL_Event event;
 
    while (continuer)
    {
 
        SDL_WaitEvent(&event);
        switch(event.type)
        {
            case SDL_QUIT:
                continuer = 0;      
        }
        rot++;   // rotation automatique puisque dans la boucle 
 
 
  glClear(GL_COLOR_BUFFER_BIT);
  glLoadIdentity();
  glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0);
  glMatrixMode(GL_MODELVIEW);
 
 
 
  glTranslatef(-0.5,0,0);
  glRotatef(rot,0,0,1.0f);
  glBegin(GL_POLYGON);
    glColor3ub(255,0,0);
    glVertex2f(-0.2,-0.2);
    glColor3ub(0,255,0);
    glVertex2f(-0.2,0.2);
    glColor3ub(0,0,255);
    glVertex2f(0.2,0.2);
    glColor3ub(255,0,0);
    glVertex2f(0.2,-0.2); 
  glEnd();
 
   glLoadIdentity(); 
   glTranslatef(0.5,-0.2,0);
   glRotatef(rot,1.0f,0,0);
   glBegin(GL_TRIANGLES);
     glColor3ub(255,0,0);
     glVertex2f(-0.2,0);
     glColor3ub(0,255,0);
     glVertex2f(0.2,0);
     glColor3ub(0,0,255);
     glVertex2f(0,0.5);
   glEnd();
 
 
	glFlush();
    	SDL_GL_SwapBuffers();
 
    }
 
    SDL_Quit();
 
    return 0;
}
Merci bien