wesleyhill wrote on Saturday, August 06, 2005:
Generally programs that make use of GLFW handle visual interaction with the user in their own way and so the addition of platform GUI support to GLFW makes no sense. This being said, I think there’s a lot of projects that would appreciate the addition of a platform-independant error box to be used when the program has failed in some catastrophic manner and the user needs to be informed. Such situations might be:
* Failure to allocate some needed memory,
* glfwInit() fails
* glfwOpenWindow() fails
or in general, any kind of unrecoverable error which means the program has to shut down and is unable to inform the user with it’s usual GUI.
I propose a new GLFW function called void glfwErrorBox( const char *message) which can only be called if glfwInit() fails, or if glfwTerminate() has been called. It doesn’t make sense to display an error box under other circumstances.
The function would look a bit like this:
GLFWAPI void GLFWAPIENTRY glfwErrorBox( const char *message)
{
if( _glfwInitialized )
return; // must glfwTerminate() first
\_glfwPlatformErrorBox\( message \);
}
_glfwPlatformErrorBox would perform, under:
- Windows: MessageBox( NULL, message, “Error”, MB_SYSTEMMODAL | MB_ICONERROR );
- OS X: StandardAlert( kAlertStopAlert, message, null, null, kAlertStdAlertOKButton );
- X11: yikes, can’t find any nice MessageBox equivalent, surely there’s something.
- Dos: puts( message );
- AmigaOS: absolutely no idea.
I think that this arrangement keeps with the GLFW ideal of a non-bloated library that provides platform-independent implementations of commonly needed functions for an OpenGL application.
I welcome any discussion on the subject.
Wesley Hill