/** * Main Programme */ int main(int argc, char** argv) { glutInit(&argc, argv); //framebuffer setup glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); // positioning and size of window glutInitWindowPosition(200, 100); glutInitWindowSize(WindowSize_X,WindowSize_Y); glutCreateWindow(argv[0]); //initialize viewpoint glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0,0,-4); tbInitTransform(); // This is for the trackball, please ignore tbHelp(); // idem MyCameraPosition=getCameraPosition(); //activate the light following the camera glEnable( GL_LIGHTING ); glEnable( GL_LIGHT0 ); glEnable(GL_COLOR_MATERIAL); int LightPos[4] = {0,0,2,0}; int MatSpec [4] = {1,1,1,1}; glLightiv(GL_LIGHT0,GL_POSITION,LightPos); //normals will be normalized in the graphics pipeline glEnable(GL_NORMALIZE); //clear color of the background is black. glClearColor (0.0, 0.0, 0.0, 0.0); // Activate rendering modes //activate depth test glEnable( GL_DEPTH_TEST ); //draw front-facing triangles filled //and back-facing triangles as wires glPolygonMode(GL_FRONT,GL_FILL); glPolygonMode(GL_BACK,GL_LINE); //interpolate vertex colors over the triangles glShadeModel(GL_SMOOTH); // glut setup... to ignore glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutDisplayFunc(display); glutMouseFunc(tbMouseFunc); // trackball glutMotionFunc(tbMotionFunc); // uses mouse glutIdleFunc( animate); init(); //main loop for glut... this just runs your application glutMainLoop(); return 0; // execution never reaches this point }
void __glXDisp_Lightiv(GLbyte *pc) { glLightiv( *(GLenum *)(pc + 0), *(GLenum *)(pc + 4), (GLint *)(pc + 8) ); }
void affichage() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glShadeModel(GL_SMOOTH); glLoadIdentity(); glLightiv(GL_LIGHT0, GL_POSITION, LightPos); glLightiv(GL_LIGHT1, GL_POSITION, LightPos2); glOrtho(-zoom, zoom, -zoom, zoom, -zoom, zoom); glRotatef(angley, 1.0, 0.0, 0.0); glRotatef(anglex, 0.0, 1.0, 0.0); Sol(); DessinPerso(); glutSwapBuffers(); }
void scene::setPositionLumiere() { glPushMatrix(); glTranslatef(xLum, yLum, zLum); int LightPos0[4] = {0,0,0,1}; glLightiv(GL_LIGHT0,GL_POSITION,LightPos0); glPopMatrix(); }
void render_scene() { //c'est ici qu'on dessine glLoadIdentity(); const float rotation = fmod(glutGet(GLUT_ELAPSED_TIME) / 1000.0 * 20, 360.0 ); glLightiv(GL_LIGHT0, GL_POSITION, posLight1); glRotated(rotation, 0,1,0); m.affichage(); }
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////MAIN /////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// int APIENTRY WinMain(HINSTANCE hInst,HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { float pos[4] = {1,1,10,1}; float dir[3] = {-1,-1,-1}; float lposSt[4] = {0,0,0,1}; float dir2[3] = {1,1,1}; int val = 180; GLfloat mat_specular[] = {3,3,3,10}; auxInitPosition( 250, 110, WIDTH, HEIGHT); auxInitDisplayMode( AUX_RGB | AUX_DEPTH24 | AUX_DOUBLE); auxInitWindow("OpenGL Laba Project!"); auxIdleFunc(oGl_Render); auxReshapeFunc(resize); glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_LIGHT1); glEnable(GL_ALPHA); glEnable(GL_BLEND); glShadeModel(GL_FLAT); glLightfv(GL_LIGHT0, GL_POSITION, pos); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir); glLightfv(GL_LIGHT1, GL_POSITION, lposSt); glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, dir2); glLightiv(GL_LIGHT1, GL_SPOT_CUTOFF, &val); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialf(GL_FRONT, GL_SHININESS, 128.0); auxKeyFunc(AUX_LEFT, Proc_Left); auxKeyFunc(AUX_RIGHT, Proc_Right); auxKeyFunc(AUX_UP, Proc_Up); auxKeyFunc(AUX_DOWN, Proc_Down); auxKeyFunc(AUX_ESCAPE, Proc_Quit); auxMouseFunc(AUX_LEFTBUTTON, AUX_MOUSELOC, Mouse_Proc); auxMainLoop(oGl_Render); return 0; }
void RSceneObjPicker::initializeGL() { glClearColor(0.9f, 0.9f, 0.9f, 1.0f); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_LIGHTING); GLfloat ambient[4] = {1.0f, 1.0f, 1.0f, 1.0f}; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); GLint position[4] = {0, 10, 0, 1}; glLightiv(GL_LIGHT0, GL_POSITION, position); glEnable(GL_LIGHT0); QList<QString> models; models.append(mmodelName); mrscDB->loadModels(reditor::RConfig::texturesDir(""), reditor::RConfig::modelsDir(""), models); mmodel = mrscDB->model(mmodelName); }
void drawMap(int width, int height, std::vector<CaseType> &map) { int LightPos[4] = {0, 0, 3, 1}; float ambient[4] = {0.45f, 0.45f, 0.45f, 1.0f}; float diffuse[4] = {1.f, 1.f, 1.f, 1.f}; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslated(0, 0, 5); glRotated(90, 0, 0, 1); glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, diffuse); glLightiv(GL_LIGHT0, GL_POSITION, LightPos); glLoadIdentity(); gluLookAt((width - 1) / 2, -height / 6, height - 5, (width - 1) / 2, height + 30, -height - 20, 0, 1, 1); drawFloor(width, height); for (int i = 0; i < width * height; i++) { switch (map[i]) { case CaseType::WALL: glLoadIdentity(); gluLookAt((width - 1) / 2, -height / 6, height - 5, (width - 1) / 2, height + 30, -height - 20, 0, 1, 1); drawCube(i % width, height - i / width - 1, 0.25, 0.4f, 0.4f, 0.4f); break; case CaseType::SNAKE: glLoadIdentity(); gluLookAt((width - 1) / 2, -height / 6, height - 5, (width - 1) / 2, height + 30, -height - 20, 0, 1, 1); drawSphere(i % width, height - i / width - 1, 0.75f, 0.f, 0.5f, 0.f); break; case CaseType::POWERUP: glLoadIdentity(); gluLookAt((width - 1) / 2, -height / 6, height - 5, (width - 1) / 2, height + 30, -height - 20, 0, 1, 1); drawSphere(i % width, height - i / width - 1, 0.5, 0.5f, 0.f, 0.f); break; default: break; } } }
ENTRYPOINT void draw_bang (ModeInfo *mi) { Display *dpy = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); GLfloat camx, camz; float r = 10.0; int LightPos[4] = {-10,0,0,1}; int MatSpec [4] = {1,1,1,1}; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bang->glx_context)); glMaterialiv(GL_FRONT_AND_BACK,GL_SPECULAR,MatSpec); glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,100); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /* set camera position */ camx = r*sin(bang->alpha) + 0.5; camz = r*cos(bang->alpha) + 0.5; bang->alpha += 0.01; if (bang->alpha == 360) { bang->alpha = 0; } gluLookAt(camx, 0.0, camz, 0.0, 0.0, 0.0, 0, 1, 0); glLightiv(GL_LIGHT0, GL_POSITION, LightPos); /* gluLookAt(10, 0.0, 10, 0, 0, 0, 0, 1, 0);*/ glPushMatrix (); drawsphere(0.1, 0.0, 0.0, 0.0); drawsphere(0.5, 3.0, 0.0, 0.0); drawsphere(1.0, 6.0, 0.0, 0.0); glPopMatrix (); if (MI_IS_FPS(mi)) do_fps (mi); glXSwapBuffers(dpy, window); }
void draw(void) { glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(posX, posY, posZ, 0, 0, 0, 0, 1, 0); glLightiv(GL_LIGHT0, GL_POSITION, LightPos); glCallList(id_plateau); timer1.Stop(); SimpleApplication::OnPreUpdate(timer1.getElapsedTime()); timer1.Start(); glutSwapBuffers(); }
void drawLight(int particle){ GLenum lights; float colorValue = 0.8; int degree = 20; if(particle == 0){ colorValue = 0.8; degree = this->pacmanDegreeVisivility; } GLint position[4]; GLfloat color[4]; GLfloat dir[3]; switch(current_direction){ case UP: dir[0]=0;dir[1]=0;dir[2]=-1; break; case DOWN: dir[0]=0;dir[1]=0;dir[2]=1; break; case RIGHT: dir[0]=1;dir[1]=0;dir[2]=0; break; case LEFT: dir[0]=-1;dir[1]=0;dir[2]=0; break; } switch (particle){ case 0: lights = GL_LIGHT2; break; case 1: lights = GL_LIGHT3; break; case 2: lights = GL_LIGHT4; break; case 3: lights = GL_LIGHT5; break; } glLightfv(lights,GL_SPOT_DIRECTION,dir); glLightf(lights,GL_SPOT_CUTOFF,degree); glLightf(lights,GL_SPOT_EXPONENT,10); position[0]=(x+0.5)*cellWidth; position[1]=Y+radiParticle; position[2]=(y+0.5)*cellHeight; position[3]=1; glLightiv(lights,GL_POSITION,position); color[0]=colorValue; color[1]=colorValue; color[2]=colorValue; color[3]=1; glLightfv(lights,GL_DIFFUSE,color); glLightf(lights,GL_CONSTANT_ATTENUATION,1.0); glLightf(lights,GL_LINEAR_ATTENUATION,0.0); glLightf(lights,GL_QUADRATIC_ATTENUATION,0.0); glEnable(lights); }
void myWindow::paintGL() { double deltaTime = t_Timer->interval()/1000.0; int LightPos[4] = {1,5,-1,0}; int Light2Pos[4] = {-2,7,2,0}; int Light3Pos[4] = {5,4,0,0}; _fx += _speed; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glLightiv(GL_LIGHT0,GL_POSITION,LightPos); glLightiv(GL_LIGHT1,GL_POSITION,Light2Pos); glLightiv(GL_LIGHT2,GL_POSITION,Light3Pos); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 1); glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 10); //zoom if(_zooming){ multiplicateurovertimezoom += 0.15; _zoom += _zoomspeed * multiplicateurovertimezoom * deltaTime; }else if(_dezooming){ multiplicateurovertimezoom += 0.15; _zoom -= _zoomspeed * multiplicateurovertimezoom * deltaTime; }else{ multiplicateurovertimezoom = 1.0; } //rotation if(_turningleft){ multiplicateurovertimerotation += 0.15; _fx -= _rotationspeed * multiplicateurovertimerotation * deltaTime; }else if(_turningright){ multiplicateurovertimerotation += 0.15; _fx += _rotationspeed * multiplicateurovertimerotation * deltaTime; }else{ multiplicateurovertimerotation = 1.0; } //angle if(_plonger){ multiplicateurovertimeplonger += 0.15; _angle += _rotationspeed* multiplicateurovertimeplonger *deltaTime; }else if(_deplonger){ multiplicateurovertimeplonger += 0.15; _angle -= _rotationspeed* multiplicateurovertimeplonger *deltaTime; }else{ multiplicateurovertimeplonger = 1.0; } //hauteur camera if(_monter){ multiplicateurovertimemonter += 0.15; _hauteurcam -= 2 * multiplicateurovertimemonter *deltaTime; }else if(_demonter){ multiplicateurovertimemonter += 0.15; _hauteurcam += 2 * multiplicateurovertimemonter *deltaTime; }else{ multiplicateurovertimemonter = 1.0; } glTranslatef(0.f, _hauteurcam, _zoom); glRotated(_angle,1,0,0); glRotated(_fx,0,0,1); //***************************************// //************* Création Mesh ***********// //***************************************// if(!meshUpToDate){ _par.resetEtageLePlusHaut(); qDebug()<<_mesh.nbFace(); largeur = 40; //du terrain longueur = 40; int largeurQuartier = 10; int longueurQuartier = 10; /* float angle = 2*3.14159265359 / 6; _mesh = Mesh::createHexaangle3D(Vector3D(cos(0),sin(0),0), Vector3D(cos(angle),sin(angle),0), Vector3D(cos(2*angle),sin(2*angle),0), Vector3D(cos(3*angle),sin(3*angle),0), Vector3D(cos(4*angle),sin(4*angle),0), Vector3D(cos(5*angle),sin(5*angle),0),1.0); */ /* Mesh m1; for(float i=-largeur/2;i<largeur/2;i+=3.1){ for(float j=-longueur/2; j<longueur/2; j+=3.1){ //for(float i=-largeur/2;i<largeur/2;i+=largeurQuartier+1){ //for(float j=-longueur/2; j<longueur/2; j+=longueurQuartier+1){ int tmp = (int)rand()%4; //tmp = 0; //qDebug()<<tmp; if(tmp == 0){ //PaterneQuad p1(Vector2D(i,j), Vector2D(i,j+longueurQuartier), Vector2D(i+largeurQuartier,j+longueurQuartier), Vector2D(i+largeurQuartier,j),&_par); //m1.merge(p1.generate()); Batiment test(Vector3D(i+(rand()%100)*0.001,j+(rand()%100)*0.001,0), Vector3D(i+(rand()%100)*0.001,j+1+(rand()%100)*0.001,0), Vector3D(i+1+(rand()%100)*0.001,j+1+(rand()%100)*0.001,0), Vector3D(i+1+(rand()%100)*0.001,j+(rand()%100)*0.001,0), &_par); m1.merge(test.generate()); }else if(tmp == 1){ float offset = (rand()%21)*0.1; Batiment test(Vector3D(i+(rand()%100)*0.001,j+(rand()%100)*0.001,0), Vector3D(i+(rand()%100)*0.001,j+1+(rand()%100)*0.001,0), Vector3D(i+1+offset+(rand()%100)*0.001,j+1+(rand()%100)*0.001,0), Vector3D(i+1+offset+(rand()%100)*0.001,j+(rand()%100)*0.001,0), &_par); m1.merge(test.generate()); }else if(tmp == 2){ float offset = (rand()%21)*0.1; Batiment test(Vector3D(i+(rand()%100)*0.001,j+(rand()%100)*0.001,0), Vector3D(i+(rand()%100)*0.001,j+1+offset+(rand()%100)*0.001,0), Vector3D(i+1+(rand()%100)*0.001,j+1+offset+(rand()%100)*0.001,0), Vector3D(i+1+(rand()%100)*0.001,j+(rand()%100)*0.001,0), &_par); m1.merge(test.generate()); }else{ float offset = (rand()%21)*0.1; Batiment test(Vector3D(i+(rand()%100)*0.001,j+(rand()%100)*0.001,0), Vector3D(i+(rand()%100)*0.001,j+1+offset+(rand()%100)*0.001,0), Vector3D(i+1+offset+(rand()%100)*0.001,j+1+offset+(rand()%100)*0.001,0), Vector3D(i+1+offset+(rand()%100)*0.001,j+(rand()%100)*0.001,0), &_par); m1.merge(test.generate()); } } } _mesh = m1;*/ /*Batiment test(Vector3D(-3+(rand()%100)*0.001,-3+(rand()%100)*0.001,0), Vector3D(-3+(rand()%100)*0.001,3+(rand()%100)*0.001,0), Vector3D(3+(rand()%100)*0.001,3+(rand()%100)*0.001,0), Vector3D(3+(rand()%100)*0.001,-3+(rand()%100)*0.001,0), &_par); _mesh = test.generate();*/ TerrainBase base(400,400, &_par); base.decoupeSimple(4000); base.shrink(4.f); base.supprPetitQuartier(400); _mesh = base.generate(); //Mesh m1 = base.generate(); /* TerrainBase base(2000,2000, &_par); base.decoupeSimple(); base.shrink(10.f); base.supprPetitQuartier(1000); Mesh m = base.generate(); _mesh = m; */ /* TerrainBase base(1000,1000); base.decoupeSimple(); for(Quartier* q : base.quartiers){ }*/ meshUpToDate = true; frame->update_values(); } glEnable(GL_LIGHTING); int nbfaces = _mesh.nbFace(); for(int i=0; i<nbfaces; i+=3){ Vector3D dir1, dir2; //pour le calcul des normals Vector3D normal; Vector3D p1 = _mesh.getVertex(_mesh.getFace(i)); Vector3D p2 = _mesh.getVertex(_mesh.getFace(i+1)); Vector3D p3 = _mesh.getVertex(_mesh.getFace(i+2)); dir1 = p2-p1; dir2 = p3-p1; normal = dir1.crossProduct(dir2); normal.normalize();; glColor3f(0.0,1.0,0.0); //Y vert glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); glBegin(GL_TRIANGLES); glNormal3f(normal.x,normal.y,normal.z); glVertex3f(p1.x,p1.y,p1.z); glVertex3f(p2.x,p2.y,p2.z); glVertex3f(p3.x,p3.y,p3.z); glEnd(); } glDisable(GL_LIGHTING); float angle = (2*M_PI)/64; glColor3f(1.0,0.2,0.2); glLineWidth(4.0f); glBegin(GL_LINE_STRIP); for(float i = 0; i < 2*M_PI ; i+=angle){ glVertex3f(cos(i)*200*_par.influenceCentreVille+_par._centreVille.x, sin(i)*200*_par.influenceCentreVille+_par._centreVille.y,10); } glEnd(); _draw_text(_par.hauteurEtageLePlusHaut.x,_par.hauteurEtageLePlusHaut.y,_par.hauteurEtageLePlusHaut.z,QString(QString::number(_par.etageLePlusHaut))); }
M(void, glLightiv, jint light, jint pname, jobject params) { glLightiv(light, pname, BUFF(GLint, params)); }
// Set specular color MapilVoid GLDirectionalLight::SetSpecularColor( const ColorARGB < MapilUChar >& color ) { GLint val[] = { color.m_R, color.m_G, color.m_B, color.m_A }; glLightiv( m_LightNum, GL_SPECULAR, val ); }
// Set ambient color MapilVoid GLDirectionalLight::SetAmbientColor( const ColorARGB < MapilUChar >& color ) { GLint val[] = { color.m_R, color.m_G, color.m_B, color.m_A }; glLightiv( m_LightNum, GL_AMBIENT, val ); }
// Set diffuse color MapilVoid GLDirectionalLight::SetDiffuseColor( const ColorARGB < MapilUChar >& color ) { GLint val[] = { color.m_R, color.m_G, color.m_B, color.m_A }; glLightiv( m_LightNum, GL_DIFFUSE, val ); }
inline void glLightv( const GLenum & light, const GLenum & pname, const GLint * params ) { glLightiv( light, pname, params ); }
// Redraw the openGl window void ObjectOpenGL::paintGL( ) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); // Set the lights GLfloat LightAmbient[]={0.4f,0.4f,0.4f,1.0f}; GLfloat LightDiffuse[]={0.8f,0.8f,0.8f,1.0f}; glLightfv(GL_LIGHT0,GL_AMBIENT,LightAmbient); glLightfv(GL_LIGHT0,GL_DIFFUSE,LightDiffuse); int LightPos[4]={0,0,10,1}; glLightiv(GL_LIGHT0,GL_POSITION,LightPos); // Move the display according to the current orientation glRotated(xRot / 16.0, 1.0, 0.0, 0.0); glRotated(yRot / 16.0, 0.0, 1.0, 0.0); glRotated(zRot / 16.0, 0.0, 0.0, 1.0); glDisable(GL_LIGHTING); // Invert the Y-axis for an orthonormal frame glScalef(1,-1,1); // Draw the frame // Draw_Frame(); // Start display of the items glPushMatrix(); // The following properties are only for the object // Zoom according to the view's parameters glScalef(Zoom,Zoom,Zoom); // ReZoom the object // Light independant (color is constant) glLineWidth(5.0); #define RAW_ACC #define RAW_GYRO #define RAW_MAG #ifdef RAW_ACC // Accelerometer glBegin(GL_LINES); qglColor(QColor::fromRgb(255 ,51 ,255)); glVertex3d(0,0,0); glVertex3d(ax,ay,az); glEnd(); #endif #ifdef RAW_GYRO // Gyroscopes glBegin(GL_LINES); qglColor(QColor::fromRgb(255,255 ,0)); glVertex3d(0,0,0); glVertex3d(gx,gy,gz); glEnd(); #endif #ifdef RAW_MAG // Magnetometer glBegin(GL_LINES); qglColor(QColor::fromRgb(32,32,32)); glVertex3d(0,0,0); glVertex3d(mx,my,mz); glEnd(); #endif Draw_Box(); glEnable(GL_LIGHTING); // Re enable the light // End of the object glPopMatrix(); // Update the view glViewport(0, 0,WindowSize.width(), WindowSize.height()); glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLfloat Ratio=(GLfloat)WindowSize.width()/(GLfloat)WindowSize.height(); glOrtho((-0.5+dx)*Ratio, ( 0.5+dx)*Ratio , +0.5+dy, -0.5+dy, -1500.0, 1500.0); glMatrixMode(GL_MODELVIEW); }
/** * Programme principal */ int main(int argc, char** argv) { glutInit(&argc, argv); // couches du framebuffer utilisees par l'application glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); // position et taille de la fenetre glutInitWindowPosition(200, 100); glutInitWindowSize(config.viewportSize_X, config.viewportSize_Y); glutCreateWindow(argv[0]); // Initialisation du point de vue glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0,0,-4); tbInitTransform(); // initialisation du point de vue tbHelp(); // affiche l'aide sur la traqueboule MyCameraPosition=getCameraPosition(); // // Active la lumière // Pour la partie // ECLAIRAGE glEnable( GL_LIGHTING ); glEnable( GL_LIGHT0 ); glEnable(GL_COLOR_MATERIAL); int LightPos[4] = {0,0,3,1}; int MatSpec [4] = {1,1,1,1}; glLightiv(GL_LIGHT0,GL_POSITION,LightPos); //glMaterialiv(GL_FRONT_AND_BACK,GL_SPECULAR,MatSpec); //glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,10); glEnable(GL_NORMALIZE); glClearColor (0.0, 0.0, 0.0, 0.0); // Details sur le mode de tracé glEnable( GL_DEPTH_TEST ); // effectuer le test de profondeur //glEnable(GL_CULL_FACE); //glCullFace(GL_BACK); glPolygonMode(GL_FRONT,GL_FILL); glPolygonMode(GL_BACK,GL_LINE); glShadeModel(GL_SMOOTH); // cablage des callback glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutDisplayFunc(display); glutMouseFunc(tbMouseFunc); // traqueboule utilise la souris glutMotionFunc(tbMotionFunc); // traqueboule utilise la souris glutIdleFunc( animate); init(); //imidiate render // lancement de la boucle principale glutMainLoop(); return 0; // instruction jamais exécutée }