VBOs and dynamic color changing
Ok i've been having a lot of toruble rendering my scene at a decent framerate and several people have told me its because i need to use Vertex Buffer Objects (VBO's). Ok so here is an example of what I'm doing...
I have a gird of 4096 squares that take up the entire iPhone screen and the color of each cornerin each square (4 in each square) must dynamically change every frame. To do this, every single drawView call i have a for loop that loops trough all 4096 squares, manually setting each one up and individual drawing each one with the correct colors before moving onto the next one. This was terribly slow (drawing 4096 objects with differnt colors individually) and i need a better method. What i want to do is...
Creat a vertex buffer object that holds all the static position coordinate of all the squares. They are in the spot every frame (only color changes) so this is no problem. However, i then want to draw then with every square having the appropriate colors (which i have in an array). Can this be done? I guess what im saying is can i create that VBO and draw each corner of each square with a different color that changes every frame.
Any code snippets? Any advice? any links? Anything could help.
Thanks a lot
Nick
|