   Getting rid of umpteen different glUniform* calls
  Hi,Something that always bothered me is the excessive amount of glUniform functions. I store my uniform data in arrays, regardless of the type (float, vec2, vec3,). As an example, I would prefer to load a vec3 by calling glUniform1fv with count 3. This works on my machine, but I'm not sure if it's legal. Currently I'm switching to use uniform buffer objects, but I want to set the uniforms in the old fashioned way for systems not supporting uniform buffers.So, does anyone know if it's legal what I'm doing?   
Quote:Legacy An older form of this functionality exists through the GL_EXT_bindable_uniform. This extension differs in many substantial ways. Essentially, it is a way of providing buffer object storage for a single uniform. The "single uniform" is allowed to be a struct, array, or array of structs rather than just a single basic type. So one could store multiple component members easily enough. This extension only provides storage for this uniform. It does not expose layout. Where UBO requires the user to use standard buffer object manipulation to fill the buffer object, bindable uniform uses the same glUniform API to change the values in the bound uniform. This also means that sharing buffers is not guaranteed. Implementations can still optimize away unused uniforms, so you cannot guarantee that you can share the same buffer object between different programs. The fact that you have to use the program object API to change the buffer object's data also means that you have to use a program object to change the stored uniform data. Since the same hardware that supports GL_EXT_bindable_uniform is just as capable of supporting GL_ARB_uniform_buffer_object, and UBO is a core extension, you are advised to prefer UBOs over bindable uniform. This is only problematic on Mac OSX, because (at the time this was written), that platform exposes bindable uniform for appropriate hardware but not UBO or any other GL 3.x extensions.(from OpenGL.org WikiIf what you're trying to do is make your code 'legacy' compatable you'd have to add some checks using GLee or whatever your extension handler is to see what OpenGL extensions are available.  The wiki states the preferable method is to use GL_ARB_uniform_buffer_object.  You'd have to write different sets of code to do the same thing, depending on the host hardware, and possibly different shaders.I may be mistaken, but apparently if you used the newer method, you may only be nixing support for Mac.   ;  Apologies if it was unclear what I'm trying to do.The default way I handle uniforms is by using uniform buffer objects, and set the uniforms using the glUniform* calls for systems not supporting the GL_ARB_uniform_buffer_object extension.All uniform data is represented on the CPU side by instances of subclasses of an UniformData class. The FloatUniformData class contains an array of float to store the data of the uniform. So if the shader declares 'uniform mat4 matrix[2]', the FloatUniformData instance has an array with size 32. An 'uniform float value' would be represented by an array with length 1. This is quite a convenient way to store data. Now I would like to send this data to OpenGL. Using uniform buffer objects it's quite easy, but when those aren't available I have to use the glUniform* functions. In my current design, it is *much* easier to use something like glUniform1fv(location, floatUniformData.dataArrayLength, floatUniformData.dataArray);to set the data for every 'float type' instead of calling the correct glUniform*f(v) function. The method above works on my current machine, but I'm not sure if it is legal.   