I have been trying to pass an array of 3-float tuples to my shader using glUniform3fv, but I get a GL_INVALID_OPERATION error. I have no problem using glUniform1fv with a float array. I can post some code, but I'd first like to know if there is some known issue. I've googled the problem and there is next to no information anywhere about glUniformXfv where X is anything other than 1. It seems like nobody is using... is that because it doesn't work?
here's a bit of the code (there are many more cases of type checking, but the TupleXX[] and variants (Vector3f etc.) don't work and give the same error)
public static void sendUniform(SPShaderUniformData udata)
{
if(udata!=null)
{
Object data = udata.data;
int uniformNum = ((Integer)(udata.nativeObject)).intValue();
if(data instanceof Tuple2f) // works OK
{
Tuple2f c = (Tuple2f)data;
gl.glUniform2f(uniformNum, c.x,c.y);
}
else if(data instanceof Integer) // works OK
{
Integer fd = (Integer)data;
gl.glUniform1i(uniformNum, fd.intValue());
}
else if(data instanceof Tuple4f) // works OK
{
Tuple4f fd = (Tuple4f)data;
gl.glUniform4f(uniformNum, fd.x, fd.y, fd.z, fd.w);
}
if(data instanceof float[]) // works OK
{
float[] array = (float[])data;
gl.glUniform1fv(uniformNum, array.length, array, 0);
}
else if(data instanceof Float[]) // works OK
{
Float[] fd = (Float[])data;