Recommended Posts

Hi,
My problem:
1. having multiple shaders (GLSL) in one program.
2. in that program i would have (lets say) 3 cubes.
3. i want the 3 different cubes to be affected by three different shaders.
So far, i can only program multiple shaders into one program and all 3 cubes are affected by the 3 shaders.
Question:
Is it GLSL-possible to have the 3 different cubes (in the same program) to be affected by different vertex/fragment shader. if yes, how?
my current solution for this right now is having three different programs with the different shaders attached to them. and toggling between the programs.

Share this post

Link to post

Share on other sites

Original post by mmakrzemYou could implement your three different shader all inside one shader. Then use a variable to branch your logic. That is what is done in the leadwerks game engine.

I can't see what there is to gain by doing this though. The whole purpose of the ogl shader program abstraction is to simplify switching between shaders for different objects. Last thing you want to do is increase the complexity of your actual shader.