In my game I want to create seperate GLSL shaders for each situation. In example if i would have 3 models character
, shiny sword
and blury ghost
i would like to set renderShader
, animationShader
and lightingShader
to the character
, then renderShader
, lightingShader
and specularShader
to shiny sword
, and finally i would like to set renderShader
, lightingShader
and blurShader
to the blury ghost
.
The renderShader
should multiply the positions of vertices by projection, world and other matrices, and it's fragmet shader should simply set the texture to the model.
animationShader
should transform vertices by given bone transforms.
lightingShader
should do the lighting and specularLighting
should do the specular lighting.
blurShader
should do the blur effect.
Now first of all how can i do multiple vertex transforms on different shaders? Because the animationShader
should calculate the animated positions of vertices and then renderShader
should get that position and trasform it by some matrices.
Secondly how can i change the color of fragments on different shader?
The basic idea is that i want to be able to use different shaders for each sutuations/effects, and i don't know how to achieve it.
I need to know how should i use these shaders in opengl, and how should i use GLSL so that all shaders would complete each other and the shaders would not care if another shader is used or not.