cginternals / globjects

C++ library strictly wrapping OpenGL objects.
https://globjects.org
MIT License
539 stars 59 forks source link

Fix Program::getActiveUniformName() #301

Closed mrzzzrm closed 8 years ago

scheibel commented 8 years ago

The documentation on glGetActiveUniform states:

glGetActiveUniform returns the name of the uniform variable indicated by index, storing it in the character buffer specified by name. The string returned will be null terminated. The actual number of characters written into this buffer is returned in length, and this count does not include the null termination character. If the length of the returned string is not required, a value of NULL can be passed in the length argument. (https://www.opengl.org/sdk/docs/man/html/glGetActiveUniform.xhtml)

Your implementation assumes the null byte is counted in the length output parameter?

scheibel commented 8 years ago

Okay, I just saw we use another method to get the length of the name for active uniforms: https://www.opengl.org/sdk/docs/man/html/glGetActiveUniformsiv.xhtml

If pname is GL_UNIFORM_NAME_LENGTH, then an array identifying the length, including the terminating null character, of the uniform name strings specified by the corresponding array of uniformIndices is returned.

Probably we should use the single uniform variant for single uniform requests...

mrzzzrm commented 8 years ago

...not sure what you mean by "single uniform variant". Alas I don't see a way of retrieving the name of uniform with a single gl call, if that's what you're getting at.

scheibel commented 8 years ago

One additional method that is used for requesting metadata of a single uniform. But this has merely to do with this PR, I wanted to document it for later.