Oh, dear.  I seem to have introduced the bug myself.  There was a good bit of discussion about resizing and the like.  If I remember correctly, the problem was that "freeglut" was calling the reshape callback immediately upon "glutReshapeWindow" being called while GLUT postponed the call until just before the first call to the display function.  There was some application (I think it was the PUI demo program called "complex") that created and reshaped the window but hid it immediately.  Then when something happened in another window it (the demo) created a PUI widget for the hidden window and revealed it.  The reshape callback referred to the widget.  Under GLUT, because the reshape callback was not called back until just before the display callback, this worked just fine.  Under "freeglut" before my supposed fix, it crashed because the PUI widget was not defined.

So ... I have two questions:

        (1) Does your program run in game mode under GLUT?
        (2) How shall we avoid both the Scylla of the early reshape callback invocation and the Charybdis of the false window sizes?  (This needs fixing whether or not the program worked under GLUT.)

John F. Fay

-----Original Message-----
From: Eero Pajarre [mailto:epajarre@koti.soon.fi]
Sent: Tuesday, January 20, 2004 2:16 AM
To: freeglut-developer@lists.sourceforge.net
Subject: Re: [Freeglut-developer] Gamemode on Windows

Eero Pajarre wrote:

> Does anybody remember breaking gamemode on Windows during
> fall/winter? ;-)
> In fgWindowProc there is code: (about line 1208)
>       window->State.NeedToResize = GL_TRUE;
>         window->State.Width  = fgState.Size.X;
>         window->State.Height = fgState.Size.Y;
> This stuffs my gamemode window with an the size specified
> in glutInitWindowSize, and sets it up for resize.

As the SourceForge Anon-CVS actually happened to work for
a while, I checked when the lines mentioned above were added.
The Width and Height setting lines are from 1.63 version for
freeglut_main.c, and the relevant comment is:

(b) Changes to postpone the handling of window resizes.

For gamemode the above change breaks because it overwrites
the correct size in window->state with non current data from
fgState. Im also a little suspicious what would happen if the
user would quickly create several windows and set the initial window
size between calls to create window.

My first attempt to fix this by checking if this is a gamemode
window failed because the code above is run for the first time
before the fgStructure.Gamemode is set, and thus finding out if
we are in gamemode failed.

At the moment I am running freeglut with the above lines
commented out, but I am not sure if this breaks something
else. (Not sure though)


The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
Freeglut-developer mailing list