Reputation: 13886
I am currently using shader pipeline objects in OpenGL (separable shader stages) along with the older style single programs with glUseProgram()
. I'm wondering, in the documentation it says:
If there is a current program object established by `glUseProgram`,
the bound program pipeline object has no effect on rendering or uniform updates.
This is confusing to me because I seem to be able to do:
glUseProgram(6); // Render using the single program
glBindProgramPipeline(pipeline_ID);
glUseProgramStages(pipeline_ID, GL_VERTEX_SHADER_BIT, shaderID);
glUseProgramStages(pipeline_ID, GL_FRAGMENT_SHADER_BIT, shaderID);
without first setting glUseProgram(0)
before calling glUseProgramPipeline
. The documentation I thought implied that it wouldn't work, but I can render fine like this. Is it necessary to set glUseProgram(0)
before calling glBindProgramPipeline
?
Upvotes: 0
Views: 633
Reputation: 473272
has no effect on rendering or uniform updates
Nothing in the code you have shown deals with "rendering" or "uniform updates". If you call glUniform
, it will go to program object 6, not to anything in the pipeline (unless 6 happens to be in the pipeline). If you render, you will use the shaders in program object 6, not those in the pipeline (again, unless 6 happens to be in the pipeline).
So long as there is a program in use, the pipeline will not affect rendering.
It should also be noted that glUseProgramStages
doesn't affect pipeline_ID
because it is bound to the context. It affects that pipeline because you pass it as a parameter. You didn't have to bind it first. Indeed, the only reason to bind a pipeline is to render with it; all of its state setting functions use DSA-style.
Upvotes: 2