I seem to be finding the opposite of this (c++ - OpenGL 3: glBindVertexArray invalidates GL_ELEMENT_ARRAY_BUFFER - Stack Overflow) case, i.e. things go awry when the element buffer is bound AFTER the vertex-array-buffer, but works when bound before (this example says theirs works when bound after, but not before.)
I’m in the end stage of porting a medium sized D3D7->D3D9 wrapper to D3D7->OpenGL and trying to work out kinks. D3D7 passes elements separately. There’s two paths that push the elements into revolving buffers. The path that does immediate data for both works, whereas the vbuffer path does not, merely because the timing in the calls is slightly different.
In the first case the elements are bound/pushed first. In the fail case second. In both cases a VAO is bound alternatively.
Basically doing the elements after the VAO setup appears to not work. It is drawing something though, that tends to obscure everything in black, somehow.
I can gather that somehow it may be possible to attach elements to VAO, and I wonder if that’s what’s happening here, perhaps even being attached to a previous VAO.
I would be interested in some theory, but mostly I can’t quite figure out how the APIs interact, and how to ensure they don’t get stuck together, and how to possibly use glDrawElements with VAO. Really this seems like an awful design (as usual for OpenGL) since it seems like the elements were attached to the VAO then it would be better to use “glDrawArrays” for that scenario. I may be completely lost here. My brain is too small for OpenGL.