RenderTexture Viewport Problem

I am trying to achieve a mini view of another part of my world node that is not necessarily visible on the screen. In the past with 2.x I have done this using RenderTexture by translating the world node so that the point of interest is at (0,0) and then calling visit() on the world node in a RenderTexture to capture the subview area of interest and then shifting it back when I am done. Essentially bringing everything else to the RenderTexture coordinate system. However now in 3.x the rendering does not happen immediately so it seems I can no longer use this trick. So I can’t help but feel I have been using the RenderTexture wrong this whole time and I just don’t understand how to use the viewport method correctly. I tried changing the viewport in the cocos2dx sample in many different ways but I only seem to be able to capture within the screen boundary. For instance using negative numbers for the origin results in the image being cut off. Does anyone have a sample of how to do this in 3.x?

Did my question possibly just not make sense?

Does anyone have an alternate solution?

Hi Chadministrator. I am future Chadministartor and I have an answer for you. Instead use the Camera class and the ClippingNode to achieve multiple views or a picture in picture effect.

Try calling Director::getInstance()->getRenderer()->render():

auto renderTexture = RenderTexture::create(size.width, size.height);
renderTexture->begin();
note->visit();
renderTexture->end();

Director::getInstance()->getRenderer()->render();

So “Director::getInstance()->getRenderer()->render();” forces the draw calls()? If so that should do the trick as well! Thanks!