I’m planning to completely switch from NVIDIA Cg to OpenGL GLSL, converting a few shaders in the process.
Converting the shaders themselves seems quite straight forward. Unfortunately, GLSL isn’t quite as crafty when it comes to combining fragment and vertex shaders, as it only supports one main function.
I really despise calling multiple render passes from inside my game code, however. Is there any more straight forward way to iterating through multiple passes than this? Preferably one where I’d just call the fragment shader after the vertex pass is finished?
The thing is, how would I convert a single cg shader into multiple (one vertex, one fragment) shaders and use them without doing a rewrite of the game code?
Take the Cartoon-Shader-Advanced sample, for example. With cg, I just load lightingGen.sha. With GLSL though, I’d have to pass through a prospective lightingGenV.sha and, after that lightingGenF.sha. Would there be any way to tell lightingGenV.sha to access lightingGenF.sha after finishing?
EDIT: Never mind. Just found a piece of documentation which helped me quite a bit. Didn’t know you could load vertex, fragment and geometry shaders in a single procedure call.
I thought I’d have to manually link them somehow.