Your suggestion sounds good.  I'd like to change the mechanism from an "assert" to an "fgError", though, and pass in the name of the function that got called.  This way the user would see a message

freeglut (<ProgramName>):  ERROR:  Function <GLUTinterfaceFunctionName> called with no current window defined.

This is considerably more meaningful than "assert failed (fgStructure.Window != NULL)".

        On a related subject, is there a desired uniform behaviour for the situation in which "glutInit" was not called before some other function was called?  Most functions fail an assert but "fgCreateWindow" simply calls "glutInit" itself.  I would vote for the latter--possibly with a warning message.  Any thoughts?

John F. Fay
-----Original Message-----
From: [] On Behalf Of Steve Baker

Sent: Wednesday, December 15, 2004 10:09 PM
Subject: Re: [Freeglut-developer] Desired "freeglut" behaviour when there is no current window

Fay John F Contr AAC/WMG wrote:

>         I would like to poll people's opinions as to what "freeglut"
> should do if the application calls a function like "glutSwapBuffers" or
> "glutPostRedisplay" when there is no current window.  I mentioned this
> in an e-mail dated 11/20/03 (note it was a year ago) asking if anybody
> had any heartburn about the function simply doing nothing.  GLUT makes
> it terminate on error.

I strongly advise that we exit with an error.

The problem is that if the application has called that function, it
probably thinks it has a window open when it doesn't.  This is a suprisingly
common problem for beginners and tends to cause weird errors that programmers
don't understand and find hard to diagnose.

Any opportunity to have one of our libraries do a good job of reporting
the problem should be grabbed with both hands.

---------------------------- Steve Baker -------------------------
HomeEmail: <>    WorkEmail: <>
HomePage :
Projects :
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++

SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
Freeglut-developer mailing list