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 6 of 6

Thread: Non-standard error behavior in glClearBuffer* on OS X

  1. #1
    Newbie Newbie
    Join Date
    Oct 2013
    Posts
    2

    Non-standard error behavior in glClearBuffer* on OS X

    In answering a question on Stack Overflow, it came to my attention that glClearBuffer (...) does not define an error when draw buffers are all GL_NONE and GL_COLOR is used. The implementation on OS X generates an Invalid Operation error, which according to the official OpenGL specification, glClearBuffer (...) is never supposed to do. Logically, raising GL_INVALID_OPERATION seems like the proper thing to do in this situation, but the specification does not mention any such behavior.

    Is this an oversight in the specification and/or is Apple doing something wrong?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    Well, it's not specified and therefore undefined behaviour - Apple obviously determined that generating an INVALID_OPERATION is appropriate. If you want, you can file request for clarification in the OpenGL spec bugzilla to get feedback and see if it's an oversight or intended.

  3. #3
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    456
    OpenGL 4.4 specifies behavior for this, it says:
    Quote Originally Posted by OpenGL_4.4_core_spec
    If the value of DRAW_BUFFERi is NONE, the command has no effect.
    but previous versions didn't specify what should happen.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    Dan, I wanted to quote that too at first, but I think Andon meant invoking ClearBuffer() when there currently are no enabled draw buffers. Otherwise,

    Quote Originally Posted by Andon13
    when draw buffers are all GL_NONE
    doesn't make much sense. I might be wrong, however.

  5. #5
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    783
    Quote Originally Posted by Andon13 View Post
    In answering a question on Stack Overflow, it came to my attention that glClearBuffer (...) does not define an error when draw buffers are all GL_NONE and GL_COLOR is used. The implementation on OS X generates an Invalid Operation error
    No, it doesn't. It no-ops.

    The person asking this question on stackoverflow should verify their context is Core Profile. OS X will throw INVALID_OPERATION (per spec) when attempting to call a deprecated function in Core Profile. Also (because OS X provides static linkage) it will throw INVALID_OPERATION when attempting to call a Core-Profile function in a 2.1 Legacy Profile.

  6. #6
    Newbie Newbie
    Join Date
    Oct 2013
    Posts
    2
    Quote Originally Posted by arekkusu View Post
    The person asking this question on stackoverflow should verify their context is Core Profile. [...] (because OS X provides static linkage) it will throw INVALID_OPERATION when attempting to call a Core-Profile function in a 2.1 Legacy Profile.
    Spot on, this was precisely the problem. The description of the problem included some superfluous details and neglected to mention the context profile.

Posting Permissions

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