In my draw method (executes every frame), I need to pass arrays of vertices coordinates to openGl.
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);
Every frame, all the vertices are recalculated even though only a few of them change. Effectively, all the vertices are shifted a few array positions to the left (the vertices in the smallest array indices are removed, and new values are added at the end of the array).
For example, the array values can change between iterations as follows.:
Iteration 1 : {0,1,2,3,4,5,6,7,8}
Iteration 2 : {4,5,6,7,8,9,10,11,12}
Instead of recomputing all the values again (even the unchanging ones), I would like to instead just compute the new values, and add them to the "end" of a circular array. (I know how to do this part).
I was wondering if there is someway I can pass a circular buffer / array to openGl instead of a regular array? Is there some way I can effectively do the same thing so I don't have to recompute all the values every frame ?