In my game, I want to create separate GLSL shaders for each situation. In the example, if I would have 3 models character, shiny swordand blury ghost, I would like to install renderShader, animationShaderand lightingShaderin character, then renderShader, lightingShaderand specularShaderbefore shiny sword, and, finally, I would like to install renderShader, lightingShaderand blurShaderin blury ghost.
renderShader should multiply the positions of the vertices by projection, world and other matrices, and this fragmet shader should simply specify the texture of the model.
animationShader must transform vertices using bone transforms.
lightingShadershould do lighting, and specularLightingshould perform mirror lighting.
blurShader should perform a blur effect.
Now, first of all, how can I perform several vertex transformations on different shaders? Because I animationShaderhave to calculate the animated positions of the vertices, and then I renderShaderhave to get this position and convert it to some matrices.
Secondly, how can I change the color of fragments on different shaders?
The main idea is that I want to be able to use different shaders for each game / effects, and I don’t know how to achieve it.
I need to know how I should use these shaders in opengl, and how I should use GLSL so that all shaders complete each other, and it would not matter to the shaders whether another shader would be used.