Why this little program doesn't work ?

nothing appears in the windows

#include <GL/glut.h>
#include <stdlib.h>

void display (void)
{

glClearColor (0.0, 0.0, 0.0, 0.0) ;
glClear (GL_COLOR_BUFFER_BIT) ;
glColor3f (1.0, 1.0, 1.0) ;
glOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0) ;
	glBegin (GL_POLYGON) ;
		glVertex3f ( 0.25, 0.25, 0.0 ) ;
		glVertex3f ( 0.75, 0.25, 0.25) ;
		glVertex3f ( 0.75, 0.75, 0.25) ;
		glVertex3f ( 0.25, 0.75, 0.0 ) ;
	glEnd () ;
glFlush () ;

}

int main (int argc, char** argv)

{
glutInit (&argc, argv) ;
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) ;
glutInitWindowSize (640, 480) ;
glutInitWindowPosition (250,250) ;
glutCreateWindow (argv [0]) ;
glutDisplayFunc (display) ;
glutMainLoop () ;
return 0 ;
}

You’ve asked for a double-buffered framebuffer (GLUT_DOUBLE) and by default rendering is set to the back buffer.

Stick glutSwapBuffers() at the end of your display function to swap front and back.

That’s the first thing I spotted… I haven’t really checked the rest.

thanks it works

[This message has been edited by airseb (edited 03-31-2002).]