PDA

View Full Version : Using the Back Buffer for FullScreen mode (3.2 core)



yousry
08-29-2012, 07:03 AM
Hi,


Because of the advice in the OpenGL Programming Guide (Drawing in full screen), I tried to create a resized back buffer (described in controlling the back buffer size) instead of changing the screen resolution.


I therefore created the pixelFormatAttributes with: NSOpenGLPFABackingStore and added observers for the fullscreen notifications:


- (void) didEnterFullScreen: (NSNotification*) notification
{
NSLog(@"didEnterFullScreen");
const GLint dim[2] = {720, 480};
[[self openGLContext] setValues:&dim[0] forParameter:NSOpenGLCPSurfaceBackingSize];
}



- (void) didExitFullScreen: (NSNotification*) notification
{
NSLog(@"didExitFullScreen");
CGLContextObj ctx = self.openGLContext.CGLContextObj;
CGLDisable(ctx, kCGLCESurfaceBackingSize);
}


The observers are called, the values are successfully changed (I reread them) but the new back buffer size is still ignored.


Any suggestions to solve the problem would be welcome.

arekkusu
08-29-2012, 09:50 AM
I believe you need to set NSOpenGLCPSurfaceBackingSize before the new drawable is attached to the context. At least, -update must be called on the context after setting this parameter for it to be noticed, so doing it in -didEnterFullScreen is probably too late.

Also, over in CGL, you must enable kCGLCESurfaceBackingSize in order for kCGLCPSurfaceBackingSize to work. It seems weird that the enable enums aren't in the NSOpenGL header, but you can CGLEnable([yourctx CGLContextObj], kCGLCESurfaceBackingSize) from your NSOpenGLView.

Also, the NSOpenGLPFABackingStore attribute is completely unrelated, you don't need that.

yousry
08-30-2012, 08:33 AM
Thank You for the info.

kCGLCESurfaceBackingSize + kCGLCPSurfaceBackingSize did the trick.