Strange result in RenderToTexture + GUI

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.

Strange result in RenderToTexture + GUI

Postby greenya » Sat Jul 10, 2010 2:29 am

Hello!

I see very strange result when using render-to-texture and the GUI. This problem repeats only on OpenGL driver. Probably this is a bug.

Test case:
Open main.cpp of 13.RenderToTexture_vc9 project:
- just before "int lastFPS = -1;" we add:
Code: Select all
env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),
   core::position2d<s32>(10,10));

- just before "driver->setRenderTarget(0, true, true, 0);" we add:
Code: Select all
env->drawAll();


So we simply added one GUIImage (Irrlicht logo) and instruction to render GUI to target texture.

I'm getting next result:
http://www.youtube.com/watch?v=csLMGu4GN7I
(Notice flipping of Irrlicht logo when i rotate camera)

Indeed when i use more GUI, for example buttons, we get more strange results (i believe thats because font is a texture, and the problem in texture usage, the flipping). For example i getting next result after some camera movement:
Image
(Notice broken text/font on the button)
User avatar
greenya
 
Posts: 942
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine

Postby Lonesome Ducky » Sat Jul 10, 2010 3:55 am

Hmm. I just tried it out and it seems that it is incorrect even if you render the gui environment AFTER and not during the render to texture. Odd. I'll try some things and get back to you

EDIT: To add, it ONLY occurs when the test cube is visible and uses the render texture on its material.
User avatar
Lonesome Ducky
Competition winner
 
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Postby CuteAlien » Sat Jul 10, 2010 6:49 am

Interesting, but no idea right now. I've moved this to the bug report forum.
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5349
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Postby xDan » Tue Nov 16, 2010 5:51 pm

I'm getting this problem in the 1.7.2. Did anyone find a fix?

Something about calling setRenderTarget with a RTT in OpenGL is messing up the GUI rendering.

The problem doesn't occur in 1.6.1, which I've been using until today...
User avatar
xDan
Competition winner
 
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK

Postby xDan » Tue Nov 16, 2010 9:34 pm

Ok, well I'm afraid I've no idea the cause of the problem, but putting this:

Code: Select all
   video::SMaterial mat;
   driver->setMaterial(mat);


...just before the GUI render fixes it.

I suppose this is resetting some state or other that got messed up somehow...!?

P.S. Thanks greenya for posting this issue, I would never have realised the RTT stuff was the problem!
User avatar
xDan
Competition winner
 
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 1 guest