Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17116

Race conditions between CPU and Renderer thread

$
0
0

@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

Read full topic


Viewing all articles
Browse latest Browse all 17116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>