iDevGames Forums
switching screen resolution - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: switching screen resolution (/thread-117.html)



switching screen resolution - NelsonMandella - Apr 25, 2010 10:47 AM

I'm tried using...

CGDisplayCapture (kCGDirectMainDisplay ) ;
CGDisplaySwitchToMode (kCGDirectMainDisplay,
CGDisplayBestModeForParameters (kCGDirectMainDisplay,
32, 1024, 768, NULL));

...to switch the screen resolution at the beginning of my app, but it just turns the screen black, the the cursor is still visible and appears pixelated as it would for 1024x768 resolution. I tried running this code at various points during my programs setup but nothing works, any idea on what might be causing this?


switching screen resolution - SethWillits - Apr 25, 2010 12:05 PM

When you capture the display, you're preventing anything with a window level below the shielding level from displaying (and other apps from even knowing that there was a resolution change). You need to make your OpenGL context or window appear above it to see anything.


switching screen resolution - NelsonMandella - Apr 25, 2010 01:16 PM

how would I do that?


switching screen resolution - SethWillits - Apr 25, 2010 01:33 PM

Look in the docs for CGShieldingWindowLevel and NSWindow's setLevel:. You'd set the level on your borderless window.

You can get the screen's full screen CGContext using CGDisplayGetDrawingContext.

If you're using NSOpenGLContext, you can use setFullscreen.

If you're using CGL, there's CGLSetFullScreen.

There's a little more info here too: http://www.idevgames.com/forum/showthread.php?t=12762