Testing for OpenGL ES Errors#

glGetError returns the last error that occurred using OpenGL ES, not necessarily the status of the last called function. Check after every single OpenGL ES call or at least once every frame. Usually this would be for debugging only, but for this example it is always enabled.

GLenum lastError = glGetError();
if (lastError != GL_NO_ERROR)
{
    Log(true, "%s failed (%x).\n", functionLastCalled, lastError);
    return false;
}
return true;

See also

External: