GetUniformLocation vs. GetUniformIndices

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() ?

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).

Interesting, then it is a coincidence that both return the same values with my nVidia card?

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.