Every time you set a uniform value, it needs to query the uniform location first. This could potentially lead to a performance loss since most shaders will require you to update multiple uniforms per frame.
Thanks, I'd never thought of this issue. Obviously a biggie. How would this be solved? Would it be more/less efficient to have a map resolving variables to IDs?
getGLVersion shouldn't be a public method of ShaderManager -- (a) because it doesn't return the expected verison (but instead just one digit) and (b) because, from an object-oriented point of view, it doesn't belong in a class about shaders
You should check for versions via the GLContext.getCapabilties().OpenGLXX booleans, and shader support with the GL_ARB_shader_objects (and vertex/frag objects) boolean also in ContextCapabilities
I'm currently refining this class again. Currently I've got an abstract class called Program, which has (along with other stuff) a load method which returns a Shader. 2 classes extend this, ARBProgram and GLProgram, which both have their own implementations of their methods. This way no class is checking if it is ARB or OpenGL2+. I'm also investigating into supporting Geometry Shaders, however this would require a whole new level checking since it's only supported on OpenGL3.2+.
All of your code could easily fit into a single class; and IMO it should be renamed to ShaderProgram. Multiple shaders (vertex, fragment, geometry) might link to a single OpenGL program
Also done. I'm thinking I could have a Program class, and if you wanted to say use a geometry shader, you could call a method attachShader(Type.geometry, source). How does this sound?
Liam (liamzebedee) Edwards-PlayneCryptum