OpenGL: required vertex array lifetime

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 top array? (Or, in other words, OpenGL will take a copy of the corresponding part and at what point?) For example, is it normal for an array to be on the stack, since it would be implicitly or should exist after glDrawArrays () is called?

[For what it's worth, I specifically program for iOS and currently work with code inside the drawFrame method created in the OpenGL project, as set by default in Xcode.]

+5
source share
2 answers

glDrawArrays, , , .

+2

, glDrawArrays/Elements , , ( glDrawArrays/Elements gl...Pointer).

( ) ( , ), . VBO, GPU ( , ), . , . VBOs.

+1

All Articles