OpenGL newbie question: if I do something like this:
GLfloat vertices[] = { .... };
glVertexPointer(3, GL_FLOAT, 0, vertices);
... set other stuff ...
glDrawArrays(...);
What is the required lifetime of the ‘vertices’ array? (Or in other words, will OpenGL take a copy of the relevant portion and at what point?) For example, is it OK for the array to reside on the stack as it implicitly would be, or is it required to exist after glDrawArrays() is called?
[For what it’s worth, I’m specifically programming for iOS, and at the moment working with code inside the drawFrame method created in an OpenGL project as set up by default in XCode.]
Your array must live until glDrawArrays, it can be destroyed afterwards and as implied by this, it can reside on the stack.