I'm getting to the point where I'm starting to have several shaders (so far up to five) and am wondering how some of you start managing these. So far my system is less than elegant and I'm sure there is a cleaner, more OO way of doing this. Here are a few of my ideas:
1) My current system is to have one Shader class which takes source code Strings as inputs in the constructor. I then have the main game class take care of compiling, binding, passing uniforms, and everything else. This is working fine for a small number of shaders but I can see it'll be way too disorganized later.
2) Have the Drawable objects (Drawable is an interface) themselves keep track of which shader to use when being drawn. This sounds like a nice solution but it'll mean that each drawable object will need references to things like the current camera and projective matrix which doesn't seem like good object oriented practice.
3) Have a ShaderManager object which takes care of uniforms and binding and have a public static method getShader() or something which drawable gives drawable objects access. Again, doesn't seem like very good OO practice since only Drawable classes actually need access to these shaders. I could pass a reference to the ShaderManager to each Drawable but I don't really like that either.
4) Something else???
Any advice would be greatly appreciated! Looking forward to a good discussion.