glUniform values are preserved when shader is uninstalled?

Hi everybody,
When a shader is uninstalled and installed later. Is necessary rewrite the Uniform values?

GLuint program1, program2;
GLuint uniform1, uniform2;

// program1, program2 with valid values

glUniform1f(uniform1, 54.34);

glUniform1f(uniform2, 23.56);

// uniform1 == 54.34??


When you say “install”, what you really mean is “use” or (more accurately, but not seen in the function call) “bind”. And yes, uniform values are state stored in program objects, so their contents are preserved when those objects are unbound (and later rebound).

Except for subroutine uniforms, which are reset every time.

Which is (one reason) why they [don’t use](Runtime selection) glUniform/glProgramUniform. Also, it’s why they shouldn’t have been called “subroutine uniforms” to begin with…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.