1

In OpenGL 4.1 the separate_shader_objects extension made it into core.

I know that I'm able to create/use a program pipeline object using gl{Gen,Bind}ProgramPipeline(). But how do I set Uniforms for this pipeline?

I've read of glProgramUniform() but don't really understand it.

I think that glProgramUniform takes a (separable) program object. When I now use a previously created program object as stage for a program pipeline and afterwards call glProgramUniform on this program object, will this affect the whole pipeline? Or do I have to call glProgramUniform for every single program object again?

1 Answer 1

3

Are you implying that stages in your pipeline have uniforms with the same name? For example, the program associated with the vertex stage has a uniform float time and the program associated with the fragment stage has a uniform float time?

Considering the whole point of separable shaders is not linking stages together, there is no notion of shared uniforms. Each stage has its own discrete namespace.

This was addressed when the extension you mentioned was first proposed:

3.  Do different program objects currently used by different shader
    types share a single name space for uniforms?

    RESOLVED:  No, different program objects have their own separate
    name space for uniforms and each has locations specific to its
    unique program object.

That means you have to set uniforms for every program object in your pipeline, even if the stages share common names.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.