I'm making some tests with OpenGL ES 2 and got some questions, my current program is like that:
Init ------- -> create index buffer -> fill index buffer glBufferData … -> create vertex buffer -> fill vertex buffer glBufferData … Draw ------- 1. Apply vertex buffer -> Bind VAO -> bind vertex buffer - enable attributs (glVertexPointer, …) -> unbind vertex buffer -> Unbind VAO -> Bind VAO 3. Apply index buffer 4. Draw
The given code crash, after some researches, I've understood why: I need to unbind my index buffer in init part (after "fill index buffer glBufferData") or unbind it before the first "Bind VAO"
My questions are:
- Can I put my index buffer in VAO (VAO stock index buffer?)?
- Did I have to unbind buffers after each update (glBufferData)?
In my application I've got some buffers who are updated on each frame (Exemple: Particles) so I've got an OpenGL stack like that:
-> bind buffer 1 -> update buffer 1 -> close buffer 1 -> bind buffer 1 -> draw
First 3 lines update the Vertex buffer, the two last draw object, that should be something like that:
-> bind buffer 1 -> update buffer 1 -> draw