voila. Je veux dessinner une sphere mais voila. la sphere ne s'affiche pas.

Voici mon code


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
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <cstdlib>
#include <SDL/SDL_image.h>
#include "sdlglutils.h"
 
void DessinerSoleil();
 
int main(int argc, char *argv[])
{
 
    SDL_Init(SDL_INIT_VIDEO);
    SDL_WM_SetCaption("systeme solaire",NULL);
    SDL_SetVideoMode(1050,800,32,SDL_HWSURFACE);
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
 
    gluPerspective(70,(double)1050/820,1,1000);
    SDL_Event event;
    glEnable(GL_DEPTH_TEST);
    DessinerSoleil();
    bool continuer = true;
 
    while(continuer)
 
    {
          SDL_WaitEvent(&event);
          switch(event.type)
          {
                case SDL_QUIT:
                continuer = false;
          }
          DessinerSoleil();
    }        
    SDL_Quit();
 
    return 0;
}
 
 
void DessinerSoleil()
{
 
         glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 
         glMatrixMode( GL_MODELVIEW );
         glLoadIdentity( );
         gluLookAt(3,0,0,0,0,0,0,0,1);
 
         GLUquadric* params = gluNewQuadric();
         glColor3ub(0,255,255);
         gluQuadricDrawStyle(params,GLU_LINE);
         glTranslated(0,0,0);
 
 
         gluSphere(params,2,20,20);
         gluDeleteQuadric(params);
 
 
 
 
 
         glFlush();
         SDL_GL_SwapBuffers();
}