I am getting GL_INVALID_VALUE, 0x0501
error at glUseProgram(mYUVProgram);
in the following code. It occurs on resuming the app. According to glUseProgram docs
GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL.
I want to know how I can check the value of mYUVProgram
, whether its valid or no, after the app has resumed. So that I can create the shader program again if mYUVProgram
's value is invalid. (I am just beginner in OpenGL so please forgive me if this question is too trivial)
CODE
void draw() {
if (!mFrameTexture) {
glGenTextures( 1, &mFrameTexture );
mProgram = Shaders::addProgram(this, (char *) Shaders::vertexShader,
(char *) Shaders::fragmentShader);
//other initialization code
CCLOG("draw:: added shader");
}
glUseProgram(mYUVProgram);
//other drawing code
}
Correct me if I am wrong , but I believe this is what you are looking for?
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glIsProgram.xhtml
eg.
if ( glIsProgram( mYUVProgram ) != GL_TRUE ){
// Recreate mYUVProgram
}
glUseProgram( mYUVProgram);