Hi, I'm thinking about implementing a scene graph with layers capability. I'm planning on making the scene graph as a general tree with a draw method that descends the prefix and draws everything to the render window (eventually).
I'm trying to figure out how to implement layers while still doing this traversal and I've decided on having 1 sf::RenderTexture per layer with each node in the scene graph having a integer to identify which layer they are on. So while I'm traversing the scene graph, instead of drawing every node directly to the render window, I query it's layer "z-index" and then draw it to the right render texture.
Lastly, when I update the render window, right before I display it to the screen, I'm going to iterate in order of z-index and draw all the render textures to the render window.
Whew, so my question actually is this: Will using Render Textures as an intermediate step really, really slow down my game loop? I'm not sure of the implementation details at this point so I'm also concerned that I'll be swapping the OpenGL context too often with no way of adding in a sprite batch capability later.
Also, if there is a better conceptual way or something in the docs that already implements this stuff, I'd totally be open to learning about it...
Thanks!