@andresote wrote:
Hey, I have a node with custom drawing implemented. I used the code in CCDrawNode as template.
My question is how should I avoid race conditions.
For example, my class has a method to draw somenthing. This function fills the VBO and updates an instance variable, called nextIndex, with the new vertex count. In the draw command I use this variable to issue the glDrawElements call like this:glDrawElements(GL_TRIANGLES, nextIndex, GL_UNSIGNED_SHORT, 0);
How can I be sure that the value of nextIndex is the right one? It's being modified from the CPU thread and being read in the Renderer thread without any kind of synchronization. Is there something I'am missing?
Posts: 1
Participants: 1