Collaboration diagram for Main Loop:
OpenGLEAN's event model is based on callbacks (see the callbacks module). This is inherited from old GLUT in design, and from freeglut and OpenGLUT in implementation. The model works simply by letting you tell OpenGLEAN which function of yours to call when certain events happen. Certain events, such as the redisplay event for updating your window graphics, can be postponed and coalesced so that one redisplay may occur in response to multiple hints to OpenGLEAN that you require a a redisplay. Some events are manufactured by OpenGLEAN, such as timers. Others may be caused by your own request, such as redisplays. Still others may only be caused by external stimulus. More...
Functions | |
void | glutInit (int *pargc, char **argv) |
void | glutLeaveMainLoop (void) |
void | glutMainLoop (void) |
void | glutMainLoopEvent (void) |
OpenGLEAN's event model is based on callbacks (see the callbacks module). This is inherited from old GLUT in design, and from freeglut and OpenGLUT in implementation. The model works simply by letting you tell OpenGLEAN which function of yours to call when certain events happen. Certain events, such as the redisplay event for updating your window graphics, can be postponed and coalesced so that one redisplay may occur in response to multiple hints to OpenGLEAN that you require a a redisplay. Some events are manufactured by OpenGLEAN, such as timers. Others may be caused by your own request, such as redisplays. Still others may only be caused by external stimulus.
You have two ways to enter OpenGLEAN's event processing model. One is via glutMainLoop(), and the other is via glutMainLoopEvent().
When OpenGLEAN has dispatched all pending events, it will do one of three things:
Old GLUT did not offer glutMainLoopEvent() nor glutLeaveMainLoop(), and would only exit glutMainLoop() if the user closed one of your windows or if you called exit(). In no case would old GLUT return control to your code by simply returning from glutMainLoop().
freeglut added some mechanisms to control this. One is an explicit glutLeaveMainLoop(). Another is a mode of execution that tells OpenGLEAN what to do if a user closes one of your windows.
OpenGLUT inherited freeglut's variations.
OpenGLEAN inherited that from OpenGLUT.
---
|
Initialize OpenGLEAN data structures.
You should take note of the interaction between glutInit() and the related functions such as glutInitWindowPosition(). OpenGLEAN always uses the most recent configuration information, so if you call glutInit(), then glutInitWindowPosition(), you prevent the user from controlling the initial window position via a command-line parameter. glutInit() will remove from pargc, argv any parameters that it recognizes in the command line. The following command-line parameters are suported:
Additionally, this function checks whether the environment variable GLUT_FPS is defined; if so, OpenGLEAN will periodically print the average number of times per second that your program calls glutSwapBuffers(). (If GLUT_FPS appears to represent a number, OpenGLEAN will take it to be the number of milliseconds that you want to pass between each output.) The idea of GLUT_FPS is measure your frame rate, but it is of limited value if you have more than one window.
|
|
Breaks out of OpenGLEAN's glutMainLoop() This function allows you to unilaterally tell OpenGLEAN that you are done and wish to exit. This is useful if you have also told OpenGLEAN to return to you rather than to call exit() directly.
|
|
The standard GLUT event loop entry point. This is the main driving force for an event-driven OpenGLEAN program. It alternates between calling glutMainLoopEvent() to process pending events and then either sleeping or calling your idle function (see glutIdleFunc()). This function can return, but GLUT's version of this function never returned. And you must do special things to OpenGLEAN to cause OpenGLEAN's version to return. The cross-reference section for this function's documentation should ideally contain every callback, but the list would be tediously long and prone to omissions. It is a fatal error to call this function without properly initializing OpenGLEAN via glutInit().
Here is the call graph for this function: |
|
Dispatches all pending events. The general outline of this function is to first drain the queue of windowsystem events, in most cases dispatching each as it is found. After the queue is empty, we check for timer-based events, coalesced window events (e.g., redisplays), and windows that need to be closed. The cross-reference section for this function's documentation should ideally contain every callback, but the list would be tediously long and prone to omissions. It is a fatal error to call this function without properly initializing OpenGLEAN via glutInit().
Here is the call graph for this function: |
Supported in part by SourceForge.net.
Generated on Fri Sep 16 20:15:33 2005 for OpenGLEAN by
doxygen 1.4.3
The OpenGLEAN project is hosted by
olib.org and
SourceForge.