Basically the thing that confuses me most is how to manage a "library" of shaders. I understand basic glsl and I've been doing stuff like that, but I don't understand how it all comes together. My engine's handle on this is that materials would contain textures and shaders (only the frag). However, objects would also have shaders (only the vertex). How would you structure this?
My other question is how to manage such a large variety of shaders (one for bump map, one for bump map with decal applied, one for bump map that recieves shadows, etc...) and have a cohesive API that understand what to give what and when. How do you figure out what a shader needs to be supplied (uniform and attribute wise). The only solution I can think of is hard coding it like so:
Code: Select all
switch(SHADERTYPE){
case BUMPMAPBASE: supply with texture, bump map texture, etc..
case BUMPMAPBASESHADOWS: supply texture, bump map texture, shadows, etc...
}
Thanks for the help guys!
Edit: Another possible solution could be that every possible shader has every possible input variable and just uses the ones it needs. This obviously would get very cluttered very fast.