I was attempting to debug why I wasn't seeing a new object (quad) being rendered, so I used the "Capture GPU frame" feature of Xcode. It usually works fine, but now it's giving me EXC_BAD_ACCESS
in another render call, during glDrawElements
.
Note that it seems similar to bugs I've seen, related to a mixed usage of VBOs and not. However, I'm definitely unbinding the VBO after usage, and disabling vertex attribute arrays:
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDisableVertexAttribArray(posAttr);
glDisableVertexAttribArray(texCoordAttr);
(Also, bear in mind that I'm only getting the crash when using "Capture GPU frame", not all the time)
What might I be doing wrong? Or could this be a bug in Xcode...?
This was indeed due to some GL state being left over, specifically a
glVertexAttribPointer
. The reason I didn't catch it was because it was an order of operations problem directly within the 3d engine itself: child objects were being iterated (and rendered) before some state was cleared up.(Apologies, this was a tediously project-specific issue)