nisalon_caje | Bonjour, j'ai le code source suivant :
Code :
- #include <GL/glut.h>
- #include <stdlib.h>
- double a=0,inca=0.1;
- /* Prototype des fonctions */
- void affichage();
- void clavier(unsigned char touche,int x,int y);
- void reshape(int x,int y);
- void idle();
- int main(int argc,char **argv)
- {
- /* initialisation de glut et creation
- de la fenetre */
- glutInit(&argc,argv);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
- glutInitWindowPosition(200,200);
- glutInitWindowSize(500,500);
- glutCreateWindow("Numéro 1" );
- /* Initialisation d'OpenGL */
- glClearColor(0.0,0.0,0.0,0.0);
- glShadeModel(GL_FLAT);
- /* enregistrement des fonctions de rappel */
- glutDisplayFunc(affichage);
- glutKeyboardFunc(clavier);
- glutReshapeFunc(reshape);
- glutIdleFunc(idle);
- /* Entree dans la boucle principale glut */
- glutMainLoop();
- return 0;
- }
- void affichage()
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glLoadIdentity();
- glTranslatef(0.0,-0.5,0.0);
- glRotatef(10.0,1.0,0.0,0.0);
- glRotatef(a,0.0,1.0,0.0);
- glBegin(GL_POLYGON);
- glColor3f(0.0,1.0,1.0);
- glVertex3f( 0.0, 0.0, 0.0);
- glVertex3f( 0.1, 0.0, 0.0);
- glVertex3f( 0.1, 0.8, 0.0);
- glVertex3f( 0.0, 0.8, 0.0);
- glVertex3f(-0.2, 0.7, 0.0);
- glVertex3f(-0.2, 0.6, 0.0);
- glVertex3f( 0.0, 0.7, 0.0);
- glVertex3f( 0.0, 0.0, 0.0);
- glEnd();
- glFlush();
- glutSwapBuffers();
- }
- void clavier(unsigned char touche,int x,int y)
- {
- switch (touche)
- {
- case 'q' :
- exit(0);
- break;
-
- case 'a':
- glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
- break;
-
- case 'z':
- glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
- break;
-
- }
- }
- void reshape(int x,int y)
- {
- if (x<y)
- glViewport(0,(y-x)/2,x,x);
- else
- glViewport((x-y)/2,0,y,y);
- }
- void idle()
- {
- a+=inca;
- if (a>360)
- a-=360;
- glutPostRedisplay();
- }
|
Cependant, comme vous pouvez le voir si vous le compilez, quand on est en mode fil de fer, on obtient le chiffre 1 alors que quand on est en mode remplissage, on obtient une autre chose "bizarre"
Comment faire pour obtenir en mode remplissage un 1 correctement rempli ?
Merci d'avance
NC
|