switching screen resolution

Member
Posts: 194
Joined: 2009.02
Post: #1
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?
Quote this message in a reply
⌘-R in Chief
Posts: 1,237
Joined: 2002.05
Post: #2
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.
Quote this message in a reply
Member
Posts: 194
Joined: 2009.02
Post: #3
how would I do that?
Quote this message in a reply
⌘-R in Chief
Posts: 1,237
Joined: 2002.05
Post: #4
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
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  DPI and Resolution for Graphics mickyg 9 8,109 Apr 27, 2012 03:02 PM
Last Post: Andres Calil
  OpenGL full screen mode leaves garbage on screen when exiting app Malarkey 5 4,932 Nov 19, 2008 12:51 PM
Last Post: Malarkey
  game image sizes and screen resolution leRiCl 5 4,114 Jul 2, 2008 03:31 AM
Last Post: leRiCl
  Changing resolution while already in full-screen mode? Malarkey 1 2,494 Jun 10, 2008 07:49 PM
Last Post: AnotherJake
  Full Screen Switching Blacktiger 3 3,386 Feb 9, 2008 03:05 PM
Last Post: Blacktiger