From: Tim R. <ti...@us...> - 2004-07-14 08:27:04
|
Update of /cvsroot/csdopenglnet/tutorials/lesson01 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12904/lesson01 Modified Files: lesson01glut.cs Log Message: additional documentation Index: lesson01glut.cs =================================================================== RCS file: /cvsroot/csdopenglnet/tutorials/lesson01/lesson01glut.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lesson01glut.cs 13 Jul 2004 22:24:19 -0000 1.4 --- lesson01glut.cs 14 Jul 2004 08:26:54 -0000 1.5 *************** *** 5,16 **** public Lesson01GLUT() { glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); glutInitWindowSize( 640, 480 ); glutCreateWindow("Lesson 01 - GLUT"); ! initGL(); ! glutDisplayFunc( new cb0_glutDisplayFunc( draw ) ); ! glutKeyboardFunc( new cb0_glutKeyboardFunc(keyboard) ); glutReshapeFunc( new cb0_glutReshapeFunc( reshape ) ); ! glutVisibilityFunc( new cb0_glutVisibilityFunc( visible ) ); glutMainLoop(); } --- 5,80 ---- public Lesson01GLUT() { + /* + set the display mode by bitwise OR-ing of GLUT diplay modes + GLUT_RGB := RGB mode window + GLUT_DOUBLE := double buffered window + The initial display mode is used when creating top-level windows, subwindows, and overlays to + determine the OpenGL display mode for the to-be-created window or overlay. + */ glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); + + /* + set the initial window size to 640 width and 480 height. + Windows created by glutCreateWindow will be requested to be created with the + current initial window position and size. The initial window sze is 300 by 300. + */ glutInitWindowSize( 640, 480 ); + + /* + creates window with title "Lesson 01 - GLUT" + glutCreateWindow creates a top-level wndow. Implicitly, the current window + is set to the newly created window. + */ glutCreateWindow("Lesson 01 - GLUT"); ! ! initGL(); // initialize the OpenGL context ! ! /* ! sets the overlay display callback / delegate ! glutDisplayFunc sets the display callback for the current wndow. When GLUT determines ! that the normal plane for the window needs to be redisplayed, the display callback for the ! window is called. ! ! GLUT determines when the display callback should be triggered base on the window's ! redisplay state. The redisplay state for a window can be either set ecplicitly ! by calling glutPostRedisplay or implicitly as the result of window damage reported ! by the window system.Multiple posted redisplays for a window are coalesced by GLUT ! to miniize the number of display callbacks called. ! */ ! ! glutDisplayFunc( new cb0_glutDisplayFunc( draw ) ); ! ! /* ! sets the keyboard callback / delegate for the current window ! glutKeyboardFunc sets the keboard callback for the current window. When a user tpes ! into the window, each key press generating an ASCII caracter will generate a keyboard ! callback. The key callback parameter is the generated ASCII character. The state of ! modifier keys such as Shift cannot be determined directly; their only effect will be ! on the returned ASCII data. ! */ ! glutKeyboardFunc( new cb0_glutKeyboardFunc( keyboard ) ); ! ! /* ! sets the reshape callback / delegate for the current window ! glutReshapeFunc sets the reshape callback for the current window. The reshape ! callback is triggered when a window is reshaped. A reshape callback is also ! triggered immediately before a window's first display callback afer a window ! is created or whenever an overlay for the window is established. The width and ! height parameters of the callback specify the new window size in pixels. Before ! the callback, the current window is set to the window that has been reshaped. The ! x and y callback parameters indicate the mouse location in window relative ! coordinates when the key was pressed. ! */ glutReshapeFunc( new cb0_glutReshapeFunc( reshape ) ); ! ! // sets the visibility callback / delegate for the current window ! glutVisibilityFunc( new cb0_glutVisibilityFunc( visible ) ); ! ! /* ! Enter the GLUT event processing loop. ! This routine should be called at most once in a GLUT program. Once called, ! this routine will never return. It will call as necessary any callbacks that ! have been registered ! */ glutMainLoop(); } *************** *** 50,53 **** --- 114,131 ---- glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + /* + swaps the buffers of the current window if double buffered. + Performs a buffer swap on the layer in use for the current window. Specifically, + glutSwapBuffers promotes the contents of the back buffer of the layer in use of the + current window to become the contents of the front buffer. The Contens of the back + buffer then become undefind. Te update typically takes place during the + vertival retrace of the monitor, rather than immediately after glutSwapBuffers is called. + + An implicit glFlush is done by glutSwapBuffers before it return. Subsequent OpenGL + commands can be issued immediately after calling glutSwapBuffers, but are not executed + until the buffer exchange is completed. + + If the layer in use is not double buffered, glutSwapBuffers has no effect. + */ glutSwapBuffers(); } *************** *** 62,64 **** ! } \ No newline at end of file --- 140,147 ---- ! } ! ! ! ! /* ! The GLUT documentation based on "The OpenGL Utility Toolkit (GLUT) Programming Interface; API Version 3;" by Mark J. Kilgard; Silicon Grphics; November 13, 996 \ No newline at end of file |