Using the Back Buffer for FullScreen mode (3.2 core)


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
    const GLint dim[2] = {720, 480};
    [[self openGLContext] setValues:&dim[0] forParameter:NSOpenGLCPSurfaceBackingSize];

  • (void) didExitFullScreen: (NSNotification*) notification
    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.

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.

Thank You for the info.

kCGLCESurfaceBackingSize + kCGLCPSurfaceBackingSize did the trick.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.