invalid display

CactusJack
Unregistered
 
Post: #1
I've started to tinker with the Core Graphics library to take control of the screen for some projects I'm playing with (basicly to learn Open GL in Cocoa). I've got this code from one of Bryan Blackburn's ports from a Nehe Open GL tutorial. My problem is this: it doesn't work on my iBook. I run this code, the screen flickers a little bit and bombs out. In the area where NSLog sends it's output I get this error: invalid display.

Code:
Code:
fullScreenMode = (NSDictionary *) CGDisplayBestModeForParameters(
                                           kCGDirectMainDisplay,
                                           colorBits, frame.size.width,
                                           frame.size.height, NULL );
      CGDisplayCapture( kCGDirectMainDisplay );
      CGDisplayHideCursor( kCGDirectMainDisplay );
      CGDisplaySwitchToMode( kCGDirectMainDisplay,
                             (CFDictionaryRef) fullScreenMode );

I run the code on my iMac (15in LCD) and it works fine.

Any ideas?

P.S. I did try it another way and got control of the screen using the method of subclassing NSWindow shown on Cocoa Dev Central (http://www.cocoadevcentral.com/tutorials...000020.php). I completed this tutorial and got it to work, but could only get keydown events in the window, and I'd like to get them in the controler.
Quote this message in a reply
CactusJack
Unregistered
 
Post: #2
Never mind. I figured got an answer from another party. I need to add:

Code:
pixelAttribs[ pixNum++ ] = NSOpenGLPFAScreenMask;
   pixelAttribs[ pixNum++ ] =
      CGDisplayIDToOpenGLDisplayMask( kCGDirectMainDisplay );

to it.
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2009.05
Post: #3
Excellent, thanks: I was wondering how to fix this.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Noobish C++ Question - invalid argument types Simie 17 5,995 Mar 7, 2009 02:39 PM
Last Post: Simie