Imagination PowerVR SDK Blog

glBindFrameBuffer, glShaderSource, glUniform error


#1

Hi,





I’m using the OpenGL ES 2.0 SDK and I’ve encountered an issue when using glBindFramebuffer. I do an error check after every OpenGL call using glGetError() and it seems like when I call glBindFrameBuffer, I get a GL_INVALID_ENUM error after I call glShaderSource! I also get errors after calling glUniformLocation or glUniform4fv, etc.





I’m not sure why this is, it also happens in the OGLES2RenderToTexture demo as well.





Any ideas?





Thanks.


#2

Hi,

Thank you for reporting that problem. This issue is known and will be fixed in next release of SDK. The problem is with calling glBindFramebuffer that produce GL_INVALID_ENUM. The other functions you have mentioned should be fine and the error you have recieved is related to glBindFramebuffer.


#3

I am encountering the same issue. Before a call to glShaderSource, glGetError returns GL_NO_ERROR, and after calling glShaderSource, I get GL_INVALID_ENUM.





Jacek’s post says this was fixed (back in '09), but I have version 2.08.28.0634, which seems to have gotten released earlier this year ('11). I, too, am checking glGetError after every OpenGL ES 2.0 function call, and everything is fine until I call glShaderSource. My code is not finished enough to be showing my graphics yet, so I can’t say if there are really any problems in rendering vs. this just being a “phantom” error.





Is it known to still be an issue?


#4

I also encountered a situation where glShaderSource is returning GL_INVALID_VALUE. According to:


http://www.khronos.org/opengles/sdk/docs/man/xhtml/glShaderSource.xml, that is generated when count is less than 0 (which it’s not, since I have it set to 1) or shader is not generated by OpenGL (also not true since I just retrieved it from glCreateShader right before calling glShaderSource). shader is a non-zero value, and I tested all the glGetShaderiv values for it (info log is zero). They all are reasonable values except for GL_SHADER_SOURCE_LENGTH. My shader is 391 characters, but GL_SHADER_SOURCE_LENGTH returns 701. This is the source (vertex shader):








#version 100


precision mediump int;


precision mediump float;


varying vec2 xlv_TEXCOORD0;


varying vec4 xlv_COLOR;


attribute vec4 a_color0;


attribute vec3 a_vertex;


uniform mat4 g_WorldViewProjection;


void main ()


{


vec4 tmpvar_1;


tmpvar_1.w = 1.0;


tmpvar_1.xyz = a_vertex;


gl_Position = (tmpvar_1 * g_WorldViewProjection);


xlv_COLOR = a_color0;


xlv_TEXCOORD0 = vec2(0.0, 0.0);


}








Even after getting the GL_INVALID_VALUE, if I go ahead and compile it and link it into a program, it does so with no further errors and nothing in the infologs.