Bug in ofShader setupShaderFromSource() - OpenGL error 1280
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);
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.
+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.