Disable screen refresh, when rendering to texture

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!

Disable screen refresh, when rendering to texture

Postby Kuzy » Fri Sep 02, 2011 8:17 am

Hello,

for generating a video I am rendering my scene to a texture. I want to use the irrlicht-window to show the rendered texture as a video-preview.

Now I discovered that irrlicht clears my window, even if I set my rendering target to texture.
The result is that my preview is flickering.

Can anyone tell me how I can prevent irrlicht to clear my window?

Thanks in advance
Kuzy
Kuzy
 
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Re: Disable screen refresh, when rendering to texture

Postby Mel » Fri Sep 02, 2011 9:29 am

Check the documentation.

http://irrlicht.sourceforge.net/docu/cl ... eb0749e7eb "setRenderTarget"
http://irrlicht.sourceforge.net/docu/cl ... 81be1e9945 "beginScene"

set the "clear backbuffer" parameter to false, and the render doesn't get cleared each time.
http://santiagong.daportfolio.com/
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 1783
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Disable screen refresh, when rendering to texture

Postby Kuzy » Fri Sep 02, 2011 11:57 am

Hi Mel,
that doesn't help.
The flags only prevent the refreshing of the buffer, but the "unrefreshed" buffer is painted everytime the WM_PAINT message is fired...
Kuzy
 
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Re: Disable screen refresh, when rendering to texture

Postby hybrid » Fri Sep 02, 2011 12:05 pm

No, that's definitely not so. There's only one framebuffer at each call that gets cleared. On beginScene it's the default backbuffer, on setRenderTarget it's the render target that will be cleared. Note, though, that on setRenderTarget(0) you will also clear the default backbuffer. So make sure that you have the flag set to flase both in beginScene and setRenderTarget(0) if you want to vavoid the clear call. Copying the backbuffer to the frontbuffer (or swapping the two) will happen on endScene, and this cannot be prevented unless by creating a much larger render loop.
hybrid
Admin
 
Posts: 13943
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Re: Disable screen refresh, when rendering to texture

Postby Kuzy » Fri Sep 02, 2011 12:26 pm

When I set both flags to false, I had an ugly rendering result (but the flickering stopped).

Now I found a solution for me:

I set the rendering rectangle to zero:
SExposedVideoData videoData = SExposedVideoData(0);
rect<s32> rec = rect<s32>(0,0,0,0);
driver->beginScene(true, true, backgroundColor,videoData,&rec);

Now my window is not cleared anymore and my texture looks like it should...

Thanks to all...
Kuzy
 
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Re: Disable screen refresh, when rendering to texture

Postby hybrid » Fri Sep 02, 2011 12:31 pm

Well, if you don't clear the zbuffer you'll get strange results. The screen will only render if there's some zfight win for the render part. Of course, this would work for plain 2d rendering, which ignores the depth information. But you should not keep the zbuffer anyway. Just set the backbuffer flag to false.
hybrid
Admin
 
Posts: 13943
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany


Return to Advanced Help

Who is online

Users browsing this forum: No registered users and 0 guests