What does glUseProgram(0) do?

后端 未结 4 994
暖寄归人
暖寄归人 2021-02-05 08:51

The OpenGL docs for glUseProgram claim that calling it with an argument of zero will cause the results of shader execution to be undefined.

However

4条回答
  •  我在风中等你
    2021-02-05 09:07

    Once you are using glUseProgram(myShader) all subsequent rendering will be done using the shader ID myShader.

    If you are calling this each time you have a material change in a modern openGL 3.1+, there is little use of glUseProgram(0).

    However, if you are planning to integrate some fixed-function rendering in there, like glVertex3f(..), then glUseProgram(0) will make sure that the last used shader is not active anymore, and it will use the fixed-function pipeline, like glColor3f(...)

提交回复
热议问题