RenderTexture: setting global z order doesn't work

RenderTexture: setting global z order doesn't work
0.0 0

#1

Adding a RenderTexture to a Node and setting its global z order has no effect; local z order is fine tho.

So, I have a Node of which a take a snapshot in a RenderTexture. I want to add this RenderTexture over some Sprites that have their global z order set (to a positive value - i.e 10 to 20). I set the RenderTexture’s global z to 30 and add as a child, BUT the other sprites with lower global z values still appear on top of it.

btw I started looking through RenderTexture’s code and I see visit and draw are overridden, but I don’t see a quick way to fix stuff, so it does what I want.

Any pointers anyone can give me?


#2

Replying to myself with a solution in case someone meets with the same problem.

Setting the RenderTexture’s Sprite child’s :slight_smile: global z would work e.g “rt->getSprite()->setGlobalZOrder(global_z)”

Most of the time RenderTexture behaves just like another Sprite (when you only need it to show the texture data it holds). It’s good at that, and I forgot that it’s actually not one.