Login  Register

Re: GL_INVALID_OPERATION after calling ShaderState.glUniform

Posted by Pete on Feb 26, 2016; 3:20pm
URL: https://forum.jogamp.org/GL-INVALID-OPERATION-after-calling-ShaderState-glUniform-tp4036347p4036374.html

Some progress - indeed the location ids are incorrect! Just need to find out how the mix-up is occuring:

On my working devices, here is the loading of the shader vs the use:

glUseProgram(<int> 0x1)
glGetAttribLocation(<int> 0x1, <java.lang.String> position) = 0
glGetUniformLocation(<int> 0x1, <java.lang.String> colour) = 2
glGetUniformLocation(<int> 0x1, <java.lang.String> mvp) = 0
glGetUniformLocation(<int> 0x1, <java.lang.String> mworld) = 1
...
glUseProgram(<int> 0x1)
glUniform(<com.jogamp.opengl.GLUniformData> GLUniformData[name colour, location 2, size 1x4, count 1, data DirectFloatBufferU[pos 0, lim 4, cap 4, remaining 4; array false, direct true, r/w true: 1.0, 0.0, 1.0, 1.0]])
glUniform(<com.jogamp.opengl.GLUniformData> GLUniformData[name mvp, location 0, size 4x4, count 1, data
0: [    0.00167    0.00000    0.00000   -1.00000 ]
0: [    0.00000    0.00260    0.00000    1.00000 ]
0: [    0.00000    0.00000   -2.00000   -1.00000 ]
0: [    0.00000    0.00000    0.00000    1.00000 ]
,
])
glUniform(<com.jogamp.opengl.GLUniformData> GLUniformData[name mworld, location 1, size 4x4, count 1, data
0: [    1.00000    0.00000    0.00000    0.00000 ]
0: [    0.00000    1.00000    0.00000    0.00000 ]
0: [    0.00000    0.00000    1.00000    0.00000 ]
0: [    0.00000    0.00000    0.00000    1.00000 ]
,
])


versus one that doesn't work:

glUseProgram(<int> 0x1)
glGetAttribLocation(<int> 0x1, <java.lang.String> position) = 0
glGetUniformLocation(<int> 0x1, <java.lang.String> colour) = 0
glGetUniformLocation(<int> 0x1, <java.lang.String> mvp) = 1
glGetUniformLocation(<int> 0x1, <java.lang.String> mworld) = 2
...
glUseProgram(<int> 0x1)
glUniform(<com.jogamp.opengl.GLUniformData> GLUniformData[name colour, location 0, size 1x4, count 1, data DirectFloatBufferU[pos 0, lim 4, cap 4, remaining 4; array false, direct true, r/w true: 1.0, 0.0, 1.0, 1.0]])
glUniform(<com.jogamp.opengl.GLUniformData> GLUniformData[name mvp, location 5, size 4x4, count 1, data
0: [    0.00104    0.00000    0.00000   -1.00000 ]
0: [    0.00000    0.00185    0.00000    1.00000 ]
0: [    0.00000    0.00000   -2.00000   -1.00000 ]
0: [    0.00000    0.00000    0.00000    1.00000 ]
,

location 5 ??????????!!!!!!!!!!!!!!!!!!

*rage*

so yeah, the location is what's wrong, your hunch was a good one :) I made the "assumption" that because it wasn't unassigned it must have been right - well you know what they say about assumptions being the mother of all ** ups :D

I'll update when I find out what's going awry.