getting Width and Height while using glutFullScreen()

Dear All,

I am going into FullScreen mode using glutFullScreen(). I need to know the dimensions of the drawing area available when I switch to that mode i.e. in Full Screen mode if the resolution is 800*600 I need to find out that width and height are 800 and 600.

(In Windowed mode this can be done easily as one can keep track of window dimensions while creating/ reshaping it.)

  • Chetan

If you know how to get the size when resizing it, why not do the same when going into fullscreen? GLUT will give the size to you in the reshape callback.

Originally posted by Bob:
GLUT will give the size to you in the reshape callback.

Yeah, that can be done.
But my problem is after getting the dimensions I am executing a code that is to be executed only at the start, and NOT after every reshape callback. So, if I use reshape, I’ll need to maitain a flag to ensure that the code is executed only after the first call to the reshapeFunc, and then just ignored - which is not a gr8 way.

  • Chetan

I don’t see what’s wrong with having a flag and a conditional jump in your reshape function. Anything special you think about?

And you do know you can change reshape function at any time, right? Have your original reshape, let’s call it A, and make a second function that performs everything you need done once, called B. At startup, you set callback to B. B will do everything you need done once, call A to set viewport and whatever, and then change the reshape callback to B.

Originally posted by Bob:
And you do know you can change reshape function at any time, right? Have your original reshape, let’s call it A, and make a second function that performs everything you need done once, called B. At startup, you set callback to B. B will do everything you need done once, call A to set viewport and whatever, and then change the reshape callback to B.

Yes! Thats a good idea. Thanks.

  • Chetan