I am writing a program that uses two different shaders for different primitives. My question is: if I bind a program, send it uniform variables, then use another shader program and come back to the first one, will the passed uniform values remain? Here is some pseudocode:
glUseProgram(shader1);
glUniform(shader1,...);
//stuff
for(elements in a list) {
if(element.type = 1) {
glUseProgram(shader2);
element.draw();
} else {
glUseProgram(shader1); //Here, do the uniforms from above remain, if shader2 was bound before?
element.draw();
}
}
See Question&Answers more detail:os