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
| #include <stdlib.h>
#include <GL/glut.h>
#include <GL/glu.h>
#include <GL/gl.h>
void Dessiner_carre(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(0.0,0.0,1.0);
glVertex2d(-0.75,-0.75);
glVertex2d(-0.75,0.75);
glVertex2d(0.75,0.75);
glVertex2d(0.75,-0.75);
glEnd();
glFlush();
glutSwapBuffers();
}
int main(int argc,char **argv) {
glutInit(&argc,argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutInitDisplayMode(GLUT_RGBA);
glutCreateWindow("carré") ;
glutDisplayFunc(Dessiner_carre) ;
glutMainLoop() ;
return(0);
} |
Partager