androidiosopengl-eserror-handlingnative-activity

OpenGL ES Error to String


Is there a standard for getting an error string from glGetError() (Android and iOS) and eglGetError() (Android) in OpenGL ES 1.1 or 2.0?

I'm using something like this:

#define AssertGL(x) { x; GLenum __gle = glGetError(); Assert(__gle == GL_NO_ERROR); }

Would be nice to enhance this to provide text to the debugger rather than having to look up the GLenum manually of the returned value stored in __gle.


Solution

  • Try this on Android: http://developer.android.com/reference/android/opengl/GLU.html#gluErrorString(int) and this on iOS: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/gluErrorString.3.html

    If those don't work for you, you can always create your own mapping from the integer error value to a corresponding string - it should be easy since there's only a handful of error values. Just look up the error values from the gl2.h and gl.h headers (they start with 0x05).