Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa and full-screen GL



I've seen a lot of examples of fullscreen OpenGL with Cocoa, and they all seem a bit lacking. Actually getting full-screen graphics is not a problem for me—CGL works as advertised—but I'm stumped as to how to best handle events! All the demos I've found seem lacking:

1 - Some will hide the menu bar and stretch a window to cover the screen. Pros: it's simple--you can use your existing NSOpenGLView code. Cons: you haven't actually entered full-screen mode, so you don't run as fast, you're still competing with other apps for VRAM on the card, etc. This is not an option for me since I am not willing to sacrifice performance.

2 - Some simple demos will enter fullscreen mode but no serious attempt is made at handling input.

3 - The other demos I've found that enter fullscreen mode will run their own event loop with, say, a while around [NSApp nextEventMatchingMask:NSAnyEventMask…].

This final option is the best thing I've found so far, but it's certainly a long way from ideal. For example, command keys are no longer processed AFAICS (maybe I need to propagate events I'm not explicitly handling, but I don't know how to do this).

I would really like it if I could capture a display with CG, enable full-screen mode with CGL but then use the regular Cocoa event loop and catch mouse-clicks and keydowns with an invisible custom NSView that floats above the shielding window. (Or it could be behind the shielding window if there were a way to keep the shielding window from eating keydowns and mouse-clicks.) I already have an NSOpenGLView subclass that handles mouse/key events, and it could easily be adapted to be a regular NSView subclass that doesn't do graphics. Is this a good idea, and more importantly is it even possible?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.