Cocoa/OpenGL drawing full-screen problem

Nibbie
Posts: 4
Joined: 2011.01
Post: #1
Hey guys,
I have a little issue here. Im trying to make my NSOpenGLView fullscreen using apple's example here.
But when I toggle fullscreen my view gets all messed up.
I have a window with an OpenGL View and I want just this View to go fullscreen instead of the entire old window.
Code:
NSView *contentView = [[MyOpenGLView alloc] initWithFrame:viewRect pixelFormat: pixelFormat];
[fullscreenWindow setContentView:contentView];
I got the code from Cocoa with Love.
I would appreciate you help.
Quote this message in a reply
⌘-R in Chief
Posts: 1,248
Joined: 2002.05
Post: #2
You'll need to be more specific than "my view gets all messed up."

You can use NSView's enterFullScreenMode:withOptions: method to get the view fullscreen. It works with NSOpenGLView too. I'm not sure why Apple's docs don't show this yet.
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2011.01
Post: #3
Its like OpenGL crashes, pixel errors are all over the fullscreen. Is the method you described good in performance on fullscreen?
Quote this message in a reply
⌘-R in Chief
Posts: 1,248
Joined: 2002.05
Post: #4
If OpenGL crashed, your app or computer would crash with it. What you're seeing is just unwritten-to video memory. That can be caused by a few things.

On 10.5 the fullscreen OpenGL context that results from calling the enterFullScreenMode: method isn't really recognized by the system as being fullscreen, so there's a bit of performance loss, but the amount is insignificant. On 10.6+ it will recognize it, and there's absolutely zero performance loss. It's as fast as can be.
Quote this message in a reply
Nibbie
Posts: 4
Joined: 2011.01
Post: #5
Thanks, works perfectly. But I can only access enterFullScreenMode from inside my NSOpenGLView, is that right?
Quote this message in a reply
⌘-R in Chief
Posts: 1,248
Joined: 2002.05
Post: #6
No, it's a public method on NSView just like any other. You can call it from anywhere you want using a pointer to the view. Cocoa doesn't use private methods.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Texture Loading Cocoa/OpenGL ultitech 1 6,848 Jan 31, 2011 12:51 PM
Last Post: mk12
  Full screen mouse events Mister T 17 8,575 Jan 4, 2010 02:55 PM
Last Post: MacMan
  Carbon events in windowed/full screen mode. Help needed. Anton Petrov 1 3,655 Dec 18, 2008 05:35 AM
Last Post: DoG
  Full Screen Event Handling kodex 4 4,716 Jun 27, 2008 08:37 PM
Last Post: OneSadCookie
  Cocoa OpenGL clapton541 3 4,898 Aug 5, 2007 09:22 PM
Last Post: BenRose3d