I'm trying to build OpenSceneGraph 3.2 for the Ubuntu armhf architecture, but I'm getting a compile error about a symbol not found. The symbol in question is glReadBuffer
. I looked at GLES2/gl2.h
header, and indeed, that symbol is not there. However, the symbol is present in GLES3/gl3.h
, and documentation online suggests that the function was added in OpenGL ES 3.0. However, I did find a function named glReadBufferNV
in GLES2/gl2ext.h
(which is not #include
'd in the source files.
I'm wondering if glReadBufferNV
can be used instead of glReadBuffer
, and what might be the possible side effects. I'm suspecting that the NV
stands for Nvidia, and that it is a Nvidia-only implementation. Is this correct? If so, is there any way to get glReadBuffer
in OpenGL ES 2.0 (I am under the impression that OpenSceneGraph can be built under OpenGL ES 2.0)?
Edit: As it turned out, the code that builds this portion of OpenSceneGraph was excluded when building with OpenGL ES or OpenGL 3.0. However, I'm still interested in what's special about glReadBufferNV
.
As your research suggests, glReadBuffer
was added to ES for 3.0; it is not defined in 2.0. Prior to that, as per the header file you found, an extension defined glReadBufferNV
— specifically the NV_read_buffer extension.
So what's happened is that something wasn't in the spec, at least Nvidia thought it would be useful, so they've implemented an OpenGL extension, which has subsequently been discussed at Khronos, had all the edge cases or ambiguities dealt with and has eventually made its way into the core spec.
That's generally how GL development proceeds: extensions come along to provide functionality that's not yet in the main library, they're discussed and refined and adopted into the core spec if appropriate.
Comparing the official specification for glReadBuffer
with the extension documentation, the extension has a few ties into other extensions that you wouldn't expect to make it into the core spec (e.g. COLOR_ATTACHMENTi_NV
is supported as a source) but see resolved issue 7:
Version 6 of this specification isn't compatible with OpenGL ES 3.0. For contexts without a back buffer, this extension makes FRONT the default read buffer. ES 3.0 instead calls it BACK. How can this be harmonized?
RESOLVED: Update the specification to match ES 3.0 behavior. This introduces a backwards incompatibility, but few applications are expected to be affected. In the EGL ecosystem where ES 2.0 is prevalent, only pixmaps have no backbuffer and their usage remains limited.
So the extension has retroactively been modified to bring it into line with what was agreed for the core spec.