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
| #include <GL/glut.h>
void display(void)
{
/* clear entire screen window to background colour (black) */
glClear(GL_COLOR_BUFFER_BIT);
/* in standard square (with corners at (-1,-1) and (1,1) )
* draw white filled square with corners at
* (-0.5, -0.5) and (0.5, 0.5)
*/
glRectf(-0.5, -0.5, 0.5, 0.5);
/* flush buffer */
glFlush();
}
/*
* Declare initial window size and position.
* Open window with "hello" in its title bar.
* Register callback function to display graphics.
* Enter main loop and wait for termination.
*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow ("hello" );
glutDisplayFunc(display);
glutMainLoop();
return 0;
} |
Partager