GLSL + uniform arrays

Started by Orangy Tang, September 24, 2005, 21:33:31

Previous topic - Next topic

Orangy Tang

I'm not quite sure what I'm doing wrong here, but I suspect I'm making a silly buffer error. I've got a
uniform float weights[numWeights]
array in a GLSL fragment shader. I can successfully get the location, type and length in my Java code and all is good.

However I can't seem to update them properly - I'm doing:
buffer.rewind();
		buffer.put(dataArray);
		buffer.flip();
		
		ARBShaderObjects.glUniform1ARB(location, buffer);

Where dataArray is a float[] and buffer is a FloatBuffer. In my fragment shader I can get correct values out of my uniform array for indices 1 to numWeights-1, but weights[0] is always 0. :shock:

Is there something special about
  • ? Or is my buffer tinkering somewhat off? Anyone any suggestions?

spasi

No, there's nothing special about
  • . It must be something else in your code.