Ok here we go, the Java code looks like this:
float[] matrixBuffer = new float[16]; /Also tested with bigger arrays ;)
CgGL.cgGLSetMatrixParameterArrayfc(cgParameter,0,1, matrixBuffer);
// Both these methods results in the same error
//CgGL.cgGLSetMatrixParameterArrayfc(cgParameter,0,0, matrixBuffer);
//CgGL.cgGLSetMatrixParameterArrayfc(cgParameter,0,16, matrixBuffer);
…and the vertex shader like this:
void main(float4 pos : POSITION,
uniform float4x4 modelViewProjection,
uniform float4x4 matrixBuffer[1],
out float4 opos : POSITION
){
opos = mul(modelViewProjection, pos);
}
Cg then reports this error.
Error code = 23, which is CG_OUT_OF_ARRAY_BOUNDS_ERROR
CgGetErrorString = Index into the array is out of bounds.
It seems like and empty array is assigned on the JNI side.
// Tomas