Do uniform values remain in GLSL shader if unbound?

前端 未结 1 858
感情败类
感情败类 2020-12-09 15:56

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 prog

相关标签:
1条回答
  • 2020-12-09 16:06

    Yes, uniforms are specific to a program, and will be persistent if you unbind and rebind it.

    Also, if you want, you could easily verify this yourself in that sample with glGetUniform.

    From the OpenGL 4.1 Specification:

    2.11.7 Uniform Variables

    ... Uniforms are program object-specific state. They retain their values once loaded, and their values are restored whenever a program object is used, as long as the program object has not been re-linked. ...

    0 讨论(0)
提交回复
热议问题