OpenGLUT Documentation
Introduction | Documentation | Examples | Proposals | Authors | Copying | Todo | Bugs | Links

OpenGLUT Window Close API Proposal

Note:
This is a proposal for the purpose of discussion and discussion. This API is not currently implemented in OpenGLUT.

Description

OpenGLUT inherits two close-window callback restration methods from freeglut. One is called glutWMCloseFunc(), the other glutCloseFunc(). Neither name is actually ideal. The two functions are identical.

Additionally, freeglut provides some mechanisms to twiddle the freeglut state machine behavior so that when a window is closed, we can exit or continue operating.

This proposal is for deprecating both of the old functions, deprecating the GLUT_ACTION_ON_CLOSE option to glutSetOption(), and adding a new function:

glutDestroyWindowFunc( int ( *callback )( int source ) );

Where source is defined as either GLUT_FUNCTION or GLUT_USER, according to whether the window is closed by user action or by the program calling glutDestroyWindow(). This allows program control over continuation of the program, using the following convention:

       int callback( int source )
       {
           return GLUT_FUNCTION == source;
       }
       

This has the following merits:

Variation: Change the default behavior to continue processing, rather than exiting, regardless of the close-event's source. The rationale for this is that the close-box (by which most GLUT_USER window-closes are likely to occur) is not guaranteed to exist on any particular platform. By changing the default to continuation, the user is encouraged to address a portable way to terminate their program. The downside is that beginners may have more important things to worry about than program termination.

Feedback

Feedback, comments or suggestions can be directed either to the mail list or discussion forum.



OpenGLUT Development @ Sourceforge
Homepage | Summary | Files | CVS | Forums | Lists | Bugs | RFE

Generated on Sat Feb 5 01:47:28 2005 for OpenGLUT by doxygen 1.3.9.1
The OpenGLUT project is hosted by sourceforge.net.