From: Tim R. <ti...@us...> - 2004-07-13 19:36:39
|
Update of /cvsroot/csdopenglnet/tutorials/lesson02 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23092 Modified Files: lesson02.cs Log Message: missing viewport Index: lesson02.cs =================================================================== RCS file: /cvsroot/csdopenglnet/tutorials/lesson02/lesson02.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** lesson02.cs 13 Jul 2004 19:06:37 -0000 1.1.1.1 --- lesson02.cs 13 Jul 2004 19:36:30 -0000 1.2 *************** *** 6,10 **** public Lesson02() { glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH ); ! glutInitWindowSize( 500,500 ); glutCreateWindow("Lesson01 GLUT"); initGL(); --- 6,10 ---- public Lesson02() { glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH ); ! glutInitWindowSize( 640, 480 ); glutCreateWindow("Lesson01 GLUT"); initGL(); *************** *** 33,45 **** } protected void reshape( int width, int height ) { if (height==0) height = 1; - if (width==0) width = 1; float h = ((float)width) / ((float)height); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); ! gluPerspective( 45.0f, h, 0.1f, 100.0f ); glMatrixMode( GL_MODELVIEW ); --- 33,56 ---- } + protected void reshape2( int width, int height ) { + float h = ((float)height) / ((float)width); + glViewport (0, 0, width, height); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + glFrustum (-1.0, 1.0, -h, h, 5.0, 5.0); + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + // glTranslatef (0.0f, 0.0f, -40.0f); + } + protected void reshape( int width, int height ) { if (height==0) height = 1; float h = ((float)width) / ((float)height); + glViewport (0, 0, width, height); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); ! gluPerspective( 45.0f, h, 0.1f, 150.0f ); glMatrixMode( GL_MODELVIEW ); *************** *** 50,54 **** glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); ! glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); --- 61,66 ---- glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); ! glPushMatrix(); ! glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); *************** *** 67,70 **** --- 79,84 ---- glEnd(); + glPopMatrix(); + glutSwapBuffers(); } |