Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Use of NSView subclass with OpenGL 3.2 gives undefined framebuffer errors

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    3

    Use of NSView subclass with OpenGL 3.2 gives undefined framebuffer errors

    Hi All,

    I've a 2008 Unibody Apple MacBook with a 2.4Ghz Core 2 Duo CPU, an 8GB RAM upgrade and an nVidia GeForce 9400M graphics chipset. It's running OS X 10.8.2.

    I'm working on a pair of variants of Apple's OpenGL 3.2-based GLEssentials project (the reflected, spinning monster), which at this stage should display a simple 'ground' made up of flat-shaded triangles. The first variant sub-classes the NSOpenGLView class, and displays the triangles in a window without any issues. The second variant sub-classes the NSView class, as opposed to the NSOpenGLView class. When I compile and run it, the output of the command "glCheckFramebufferStatus(GL_FRAMEBUFFER)", situated immediately after creating a rendering context and making it current, is GL_FRAMEBUFFER_UNDEFINED. Further to that, the shader validation returns "Validation Failed: Current draw framebuffer is invalid." Needless to say, nothing gets rendered. I get the impression these errors pertain to the default framebuffer (object number of 0). I'm told that this should be set up automatically when the rendering context is created.

    According to this page this can be resolved. If someone can enlighten me on how it would be greatly appreciated. It wouldn't surprise me if it was absurdly simple. :-| Happy to provide source code if need be.

    Thanks in advance.

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    783
    See the documentation:

    Working With Rendering Contexts
    http://developer.apple.com/library/m..._contexts.html
    which notes that NSOpenGLView handles on your behalf (via the -update method) associating the view with the context.

    and Drawing to a Cocoa View
    http://developer.apple.com/library/m...l_drawing.html
    which shows an example of a custom NSView implementation (note -update etc, you are responsible for re-implementing the NSOpenGLView machinery.)

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2012
    Posts
    3
    Thanks for the links, arekkusu. I'd read them before, but hadn't paid the same sort of attention as I've done now. Having followed the instructions more closely (particularly with the implementation of the prepareOpenGL method), I'm pleased to say that I've got OpenGL 3.2 and NSView sub-classes playing together just nicely, and rendering what I want.

Posting Permissions

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