How to bind texture and uniform block for separate shader stage?

Opengl 4.1 introduce separate program:
https://www.opengl.org/wiki/Shader_Compilation#Separate_programs

But i have problem, how to separate set “uniform block” and “Texture” for each shader stage?

// i bind a pipeline, but how to separate set "Uniform block" and
// "Texture" for each shader stage.
glBindProgramPipeline(PipelineID);

//i want separate set texture for each stage
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, TextureID);

//Uniform block too, i want separate set for each stage.
glBindBufferBase(GL_UNIFORM_BUFFER, 0, VarBufferBlockID);

Ps: Sorry, i can’t find anywhere to insert code, so i highlight it. thanks in advance.

Textures and uniform blocks are not per-stage; they’re per-pipeline. So different programs in different stages could access the same texture image unit or uniform block binding point. Or they can access different ones.

If you want them to use separate resources, it’s up to you to assign each program to use separate resources.

Thanks, I will assign resource for pipeline instead of shader stage. :slight_smile: