O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Debugging with glGetError

With OpenGL, one of the first ways to troubleshoot a problem is by checking if we made a call or passed in an argument that OpenGL didn’t like. We can do this by calling glGetError to get the state of OpenGL’s error flags. Here are some of the most common error codes:

GL_INVALID_ENUM

We passed in a value to a function that doesn’t accept that value. For example, maybe we passed in GL_FLOAT to glEnable or something else that doesn’t make sense for that function.

GL_INVALID_VALUE

One of the numeric arguments we passed in to a function was out of range.

GL_INVALID_OPERATION

We tried to perform an invalid operation for the given OpenGL state.

In addition to glGetError, we also have more specific ways of looking for an error, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required