OpenGLEAN
OpenGLEAN User Support
Home page | Introduction | Documentation | Files | Examples | Proposals | Authors | Links


OpenGLEAN Development
Summary | CVS | (discussion via home page) | (contact via home page) | (suggestion box) | License | Todo | Bugs

Window Close API Proposal

This proposal was originally authored for OpenGLUT.

Description

OpenGLEAN 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.



SourceForge.net Logo Supported in part by SourceForge.net.

Generated on Fri Sep 16 20:15:32 2005 for OpenGLEAN by doxygen 1.4.3
The OpenGLEAN project is hosted by olib.org and SourceForge.