Pseudocode:
void draw()
{
Vertex* vertices = scene.GetVertexArray();
glEnableClientState(...);
glVertexPointer(..., vertices);
glDrawArrays(...);
glDisableClientState(...);
delete vertices;
}
I'm not using VBO since I want to support older OpenGL implementations.
After calling glDrawArrays, I want to:
- deallocate my vertex array ("
delete vertices;
") - perhaps modify some of the vertices
However, GL is free to perform the glDrawArrays asynchronously, and it's not safe to deallocate or modify my array until it has finished.
I could do a glFinish to ensure that, but it'd slow down the app.
So at what moment am I free to deallocate/modify my vertex array?