Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Bug in ofShader setupShaderFromSource() - OpenGL error 1280 #1515

Closed
digitologist opened this Issue Aug 28, 2012 · 3 comments

Comments

Projects
None yet
4 participants

Just upgraded my project to 0071, and got a new error in my console:

OF: OF_LOG_ERROR: OpenGL generated error 1280 trying to get the compile status for GL_FRAGMENT_SHADER shader. Does your video card support this?

I tracked it down to the following lines:

// check compile status
GLint status = GL_FALSE;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
GLuint err = glGetError();
if (err != GL_NO_ERROR){
ofLog( OF_LOG_ERROR, "OpenGL generated error " + ofToString(err) + " trying to get the compile status for " + nameForType(type) + " shader. Does your video card support this?" );
return false;
}

Despite the status resolving to true, the glGetError() check was delivering an error 1280. I was able to fix the problem by adding another call to glGetError() earlier in the function body:

// create program if it doesn't exist already
checkAndCreateProgram();
GLuint clearErrors = glGetError();

// create shader
GLuint shader = glCreateShader(type);

Owner

bilderbuchi commented Aug 28, 2012

Doesn't that just mean that an error (1280) is happening earlier? In that case, that error should also be caught/logged imo.

Correct, haven't worked to track down where that's coming from yet, though a more error-proof way to perform this check would be to first check the status variable to see if the shader failed to compile, and only check err against GL_NO_ERROR in the case that it's still false.

Contributor

andreasmuller commented Feb 20, 2013

+1 on the proposed solution above. When tinkering with new platforms and windowing systems you're pretty likely to get a mostly harmlessGL error throw in here and there on initialisation.

@ghost ghost assigned ofTheo Jul 7, 2013

ofTheo added a commit that referenced this issue Jul 7, 2013

ofTheo added a commit that referenced this issue Jul 7, 2013

@ofTheo ofTheo closed this Jul 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment