JOGL Debug is reporting a GL_INVALID_OPERATION error when I'm trying to upload a FloatBuffer containing 4x4 matrix data to a shader uniform. I can't figure out what the problem is?
Looking at the OpenGL C docs, GL_INVALID_OPERATION can be reported for quite a few reasons:
http://www.opengl.org/sdk/docs/man4/xhtml/glUniform.xmlThe FloatBuffer is of size 16 floats, and I tested the actual computed matrix data (it's an ortho-projection matrix) in a mat4 constant on the vertex shader - it worked. So, the problem is only occurring with the upload process.
I set the uniform matrix via the following call:
gl.glUniformMatrix4fv(getLocation(name), 1, false, values); // values = the non-null, capacity 16,
// zero position FloatBuffer
The getLocation(String) method is:
private int getLocation(String uniform) {
return gl.glGetUniformLocation(progId, uniform);
}
The name variable is the mat4 uniform's name on the vertex shader. It's declared in the shader as:
uniform mat4 ortho;
And used as:
gl_Position = ortho * pos; // where pos is a vec4 containing the passed vertex attribute
Any help is appreciated. I really have no idea what's wrong :(
Edit: Addendum - Full error message:
GLDebugEvent[ id 0x502
type Error
severity High: dangerous undefined behavior
source GL API
msg GL_INVALID_OPERATION error generated.
Uniform not found.
when 1390875845182
source 4.3 (Compat profile, arb, debug, ES2 compat, ES3 compat, FBO, hardware) - 4.3.0 NVIDIA 310.44 - hash 0x2e1c3062]
glGetError() returned the following error codes after a call to glUniformMatrix4fv(<int> 0x3E, <int> 0x1, <boolean> false, <java.nio.FloatBuffer> java.nio.DirectFloatBufferU[pos=0 lim=16 cap=16]): GL_INVALID_OPERATION ( 1282 0x502),
-----------------------------------
Additional edit:
I just noticed that "Uniform not found" message. I double checked. The name being passed matches how it's declared in the vertex shader. Do I have to do something to the buffer or method call to match the mat4 properly?