Pitfalls to Watch Out For

Sometimes the problem isn’t obvious: glGetError doesn’t return anything unusual, and the traces appear fine. Other times, the app might blow up with a segmentation fault at an unexpected place, robbing us of the chance to put in a breakpoint and figure out what’s going on. When these problems occur, we have to fall back to standard debugging techniques and narrow things down until we find the problem.[94]

One of the easiest methods to get wrong is glVertexAttribPointer (see Associating an Array of Vertex Data with an Attribute for a refresher), and getting it wrong will often lead to strange display issues and segmentation faults. As an example, let’s say that we have a vertex array for an object with a position attribute, ...

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.