eljoundi to Be or not to Be ? | Bonjour,
j'ai un petit probleme avec un bout de code d'un programme en C utilisant la librairie GLUT pour l'affichage
le but en fait est d'afficher des segments avec 2fonctions, j'ai beau essaye mais ca ne marche pas, je voudrai donc savoir si qulq'un du Forum pourrait m'aider à resoudre ce probleme assez urgent :
voila le code :
Code :
- // (x1,y1) et (x2,y2) sont 2points
- void dessineSegment(float x1, float y1, float x2, float y2) {
- glLineWidth(3.0) ;
- glBegin(GL_LINES) ;
- glVertex2fx1,y1);
- glColor3f(0,1,0) ;
- glVertex2f(x2,y2);
- glColor3f(1,0,1) ;
- glEnd() ;
- glLineWidth(1.0) ;
- }
- void display(float x1, float y1, float x2, float y2) {
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- glPushMatrix();
- dessineSegment(x1,y1,x2,y2) ;
- glPopMatrix();
- glFlush();
- glutSwapBuffers() ;
- }
|
or cela ne m'affiche pas le segment alors que ca marche bien de cette maniere :
Code :
- void display(void) {
- glClearColor(0.0F,0.0F,0.0F,0.0F) ;
- glClear(GL_COLOR_BUFFER_BIT) ;
- glColor3f(1.0F,1.0F,1.0F) ;
- glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0) ;
- // Dessin du Segment
- glBegin(GL_LINES) ;
- glVertex2f(0.5,0.5) ;
- glVertex2f(0.5,-0.5) ;
- glEnd() ;
- glFlush() ;
- }
|
mais avec le deuxieme code, je ne peux choisir mes points même en donnant des arguments à la procedure display
En vous remerciant d'avance Message édité par eljoundi le 10-05-2006 à 21:55:03
|