   Multiple Shaders in GLSL
  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.   
  Creating 3 different programs and switching between them is the correct way. A single program will perform the same render operations on all geometry it is used on. You could technically use only one program and switch and relink the shader objects in it between the draw calls, but that would be just silly.   ;  [ You could technically use only one program and switch and relink the shader objects in it between the draw calls, but that would be just silly. ]that is what i did previously... haha...i thought so... there is no way 2 shaders can have 2 different impact on 2 different objects in the same program. =.="thanks for the clarification tho...;  You 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.   ;Quote: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.Perhaps that's not a good idea. Perhaps it will reduce performance specially when used in the FS.   ;Quote: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.   