   how come polygon doesn't appear
  hi guys, i'm new to gl, i'm now following the opengl guide (redbook), i ran the first sample of the book, but no polygon was showed out as it is said in the book.the book's sample uses some head files which i can't find. the sgi ftp cannot be connected. so i modified the sample a bit.here is it:#include <GL/glut.h>#include <stdlib.h>void init(void) {   glClearColor (0.0, 0.0, 0.0, 0.0);   glShadeModel (GL_FLAT);}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(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);glBegin(GL_POLYGON);glVertex2f(-50, -50);glVertex2f(-50, 50);glVertex2f(50, 50);glVertex2f(50, -50);glEnd();glFlush();}void reshape (int w, int h){   glViewport (0, 0, (GLsizei) w, (GLsizei) h);    glMatrixMode (GL_PROJECTION);   glLoadIdentity ();   glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);   glMatrixMode (GL_MODELVIEW);}void keyboard(unsigned char key, int x, int y){   switch (key) { case 27:    exit(0);    break;   }}int _tmain(int argc, _TCHAR* argv[]){   glutInit(&argc, argv);   glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);   glutInitWindowSize (500, 500);    glutInitWindowPosition (100, 100);   glutCreateWindow (argv[0]);   init ();   glutDisplayFunc(display);    glutReshapeFunc(reshape);   glutKeyboardFunc(keyboard);   glutMainLoop();   return 0;}there should be a white box in the middle of the screen, but what i got is only a solid black background. :( so what's the problem? thank you!screen shot:
  Tried switching to the projection matrix before calling glOrtho?   ;Quote:Original post by billconanthe book's sample uses some head files which i can't find. the sgi ftp cannot be connected. so i modified the sample a bit.Either that sample was completely borked or you modified it a bit too much.display function:glClearColor(0.0, 0.0, 0.0, 0.0);No reason do do that every single frameglOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);See above, plus you didn't change to the projection matrix, plus you didn't load the identity matrix either, meaning you keep multiplying this to the modelview matrix again and again with every frame.glVertex2f(-50, -50);All coords are way outside the frustum you set up so in a best case you would see nothing but white. But you won't, as you don't specify a z coord it is set to 0, which is closer than the near clipping plane you set to in your call to glFrustum 1.5.reshape function:glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);Isn't using the resolution/window size anyway, so no need to set it again. Doesn't hurt, though.   ;  if I'm not mistaken the glortho just makes an orthographic matrix and multiplies it to the current model view matrix.  if this is the case your modelview matrix will constantly be multiplied over and over every frame.  I don't see you loading the identity matrix so I'd expect whatever operations you're doing in the display func to accumulate.  what you want is the same operation being applied every frame.  not to accumulate your changes.  try glLoadidentity() before your display func   