I'm working on shaders for an android OpenGL ES 2.0 program. This is the error message. I google'd it and found nothing.
java.lang.IllegalArgumentException: length - offset < count*4 < needed
at android.opengl.GLES20.glUniformMatrix2fv(Native Method)
This works on my Droid Bionic, but not my Samsung Galaxy Tab Pro. The actual line in question reads as follows:
GLES20.glUniformMatrix2fv(m_u_texture_position, 1, false, m_u_texture_position_floats, 0);
m_u_texture_position_floats is a 2 element array of floats. Anyone know why this is?
glUniformMatrix2fv()
sets the value for a uniform of type mat2
. mat2
is a 2 by 2 matrix, so it requires 4 floats.
For a uniform variable with 2 values, the type in the shader code should be vec2
, and you will use glUniform2fv()
to set the value:
GLES20.glUniform2fv(m_u_texture_position, 1, m_u_texture_position_floats, 0);