PDA

View Full Version : GetUniformLocation vs. GetUniformIndices



dv
06-14-2011, 06:10 AM
Hi,

with glGetUniformLocation(), I can retrieve an index for *one* uniform. With glGetUniformIndices(), I can do the same, but also for >1 uniforms.

However, if I just want to retrieve one uniform index, are both equivalent? Or should I still use glGetUniformIndices() instead of glGetUniformLocation() ?

Alfonse Reinheart
06-14-2011, 01:03 PM
A uniform index is not the same thing as a uniform location. Uniform locations are used by glUniform* calls to modify uniform data stored in programs. Uniform indices are used for querying information about uniforms (name, type, etc).

dv
06-18-2011, 03:08 AM
Interesting, then it is a coincidence that both return the same values with my nVidia card?

Alfonse Reinheart
06-18-2011, 03:44 AM
Interesting, then it is a coincidence that both return the same values with my nVidia card?

It's a "coincidence" in the sense that the OpenGL spec does not require this behavior. But it doesn't forbid it either.