I implemented a custom node to do openGL drawing, similar to CCDrawNode, including use of a _vao/_vbo and no need to keep buffering vertices that have not changed.
My custom node is working great - so that’s not the nature of my question.
However, I was surprised to find that the draw(…) method on my node is called repeatedly, even though absolutely nothing in the scene has changed, with perhaps the exception of the need to draw the frame rate stats.
I walked through all the director code to get an idea of how it works, and I know the model in openGL has everything render when it renders a camera view (rather than only drawing some “dirty” rects)
As a software engineer this bothered me enough to wonder if I’m not understanding something.
I see that a scene can be paused, and animation can be stopped, which will stop the tight drawing loop, so freezing a scene is possible this way.
Shouldn’t any “events” driven by the animation loop be separate from processing the drawing of nodes, and let the results of such events cause marking as need for drawing?
Wouldn’t it be better if director does not erase and redraw a scene where absolutely nothing has changed?
Shouldn’t frame rate stats be in a separate buffer so they don’t force the entire scene to redraw repeatedly? Shouldn’t any of the many objects that get a state change just set a flag on a scene marking that it needs a redraw, and if no flag is set, shouldn’t cocos2d just leave the current rendered scene as is? (Saves cycles, saves power, etc.)
Or is there a way to do this already that I missed?