Render To Texture And Hidden Windows

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
kkrizka
Posts: 70
Joined: Sun Sep 30, 2007 3:10 am

Render To Texture And Hidden Windows

Post by kkrizka »

Hi there,

I have my Irrlicht scene embedded inside another window, via the external API. In addition to that, I have a static image (changed rarely) showing the scene from some other camera. This image is created by drawing the scene via a render-to-texture, and copying the data. This works pretty well.

However, sometimes I hide the irrlicht scene to show something else, but not the static image. But the static image can get refreshed even when the irrilcht scene is hidden. However, in that case the static image will always show the last scene rendered to it while the main irrlicht scene was shown.

For example, suppose I have two static images (cam1 and cam2) and I do the following:

1) Update cam1 image
2) Update cam2 image
3) Hide Irrlicht scene
4) Update cam1 image
5) Update cam2 image

Then both the static images for cam1 and cam2 will show the same thing, the image made in (2).

The scene is hidden (I looked at the widget library's code) via:

Code: Select all

XUnmapWindow()
The image update code is:

Code: Select all

  ICameraSceneNode *originalCamera=getSceneManager()->getActiveCamera();
  originalCamera->grab();
  getVideoDriver()->setRenderTarget(rt, true, true, color);
  getSceneManager()->setActiveCamera ( cam );
  getSceneManager()->drawAll();
  getSceneManager()->setActiveCamera (originalCamera);
  originalCamera->drop();
  getVideoDriver()->setRenderTarget(0);
I've also tired wrapping the whole thing in begin/endScene() calls, without any difference in the result. Also, same problem is with Irrlicht 1.5 and SVN trunk. Also, I'm using the OpenGL driver. Finally, I'm using Ubuntu Linux Jaunty Jackalope and have an Intel card.

I won't be surprised if my use case isn't supported by Irrlicht, but I would appreciate it if people offered suggestions on how I could debug this.

Thank you.
Cheers,
Karol Krizka

http://www.krizka.net
Post Reply