Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Using the Back Buffer for FullScreen mode (3.2 core)

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011

    Question Using a resized Back Buffer in 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.
    Last edited by yousry; 08-29-2012 at 06:40 AM. Reason: clarification

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2011
    Thank You for the info.

    kCGLCESurfaceBackingSize + kCGLCPSurfaceBackingSize did the trick.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts