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?

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.

OpenGL 4.4 specifies behavior for this, it says:

but previous versions didn’t specify what should happen.

Dan, I wanted to quote that too at first, but I think Andon meant invoking [b]ClearBuffer/b when there currently are no enabled draw buffers. Otherwise,

doesn’t make much sense. I might be wrong, however. :slight_smile:

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.

Spot on, this was precisely the problem. The description of the problem included some superfluous details and neglected to mention the context profile.