View Full Version : AGL switch from fullscreen to windowed

01-17-2006, 06:10 AM
Hi folks,

can someone please help me on this?
I set fullscreen with aglSetFullScreen, i know how to do a window
and how to switch from window to full.

But what steps are required to switch to windowed, once i am in
fullscreen? On top with the nice fading aglSetFullscreen does?

Another (curios) thing: when i try to crate the pixelformat

the cration fails, without AGL_FULLSCREN or even with
AGL_WINDOW it works fine and i get my fullscreen.
Im doing it with AGL, Carbon, C++ on 10.4.

Any ideeas?

01-17-2006, 10:11 AM
http://onesadcookie.com/book shows how.

Note: the code there may still use aglSetFullScreen(0, 0, 0, 0) -- that broke in 10.4.

01-17-2006, 01:19 PM
Once you've created your AGLContext, you don't need to re-create an OpenGL context if you change resolution or switching back to the windowed mode.

Instead, just change your resolution back to the original display mode with CGDisplaySwitchToMode

Then call aglSetCurrentContext then aglUpdateContext and finally aglSetFullScreen(<your context>, 0, 0, 0, 0);

This is working for me on MacOS 10.4.4

I can switch back from windowed / fullscreen or switching resolution.

01-19-2006, 07:44 AM

thanks for your help so far!

Im still working on implementig yor tips,
by now the switching is working at long last.

But ... :)
Now the fullscreen isnt drawn at all and if i
quit the app the desktop keeps black too,
untill i drag some window around and cause it
to be redrawn by the system.

Before quitting i aglSetCurrentContext(NULL)
and destroy all contexts i've created. Then i
pass the event to the default window handler
(CallNextEventHandler) to do whats left.

I have this problem only when specifying a GDevice
with aglChoosePixelformat. Do i have to release the
GDvice somehow? (i do a ReleaseWindow(win))

I admit, i totally missed the CDGDisplay Api.
It's still not fully documented, what parameter
do i have to pass for 'mode' in
CGDisplaySwitchToMode(CGDirectDisplayID display, CFDictionaryRef mode)?

Many thanks!

02-02-2006, 12:35 AM

i got it working now with the 2-Contexts solution.
The problems i had were solved by seting the drawable
to nil for fullscreen and destroying the fullscreen context
to get back to the window.

I had no luck with CGDisplaySwitchToMode.

Many thanks!