How do I debug OpenGL ES errors?
OpenGL ES 1.1 likes my iPhone program to crash if something goes a little wrong.
This usually happens somewhere inside glDrawArrays, with multiple calls to glDestroyContext per stack.
I usually share in half the problem by inserting
{
GLint iErr = glGetError();
if (iErr != GL_NO_ERROR)
{
NSLog(@"GL error: %d (0x%x)", iErr, iErr);
}
}
everywhere.
However, sometimes this is not enough. Are there other ways to get useful diagnostics for the cause of the failure?
source to share
Are you getting error messages on the console output? Just from the description, I wonder you are getting an exception BAD_ACCESS
. If my guess is correct, you are probably passing a bad array to glVertexPointer
, glColorPointer
or one of the other related functions.
Am I correct in assuming that he dies in glDrawArrays
and never returns? In other words, is there no way to call glGetError
after glDrawArrays
because the program has already crashed?
source to share