/* Set Projection */ glMatrixMode( GL_PROJECTION ); glLoadIdentity(); //glOrtho( 0, 640, 480, 1, -100, 100 ); // way #1 gluPerspective(60, 640/480, 1, 10000); // way #2 (best!) //glFrustum( 0, 640, 480, 1, 1, 100); // way #3 glMatrixMode( GL_MODELVIEW ); /* Fix some shading stuff */ glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); /* Enable smooth shading & lighting */ glShadeModel( GL_SMOOTH ); glEnable(GL_LIGHTING); /* Set the background black */ glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); /* Depth buffer setup */ glClearDepth( 1.0f ); /* Enables Depth Testing */ glEnable( GL_DEPTH_TEST ); /* The Type Of Depth Test To Do */ glDepthFunc( GL_LEQUAL ); /* Really Nice Perspective Calculations */ glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );