Page 1 of 1

[fixed]IGUIStaticText->setBackgroundColor()

Posted: Sun Aug 10, 2008 1:34 am
by pc0de
This problem started happening at revision 1424. Here's the code snippet for testing:

Code: Select all

IGUIStaticText* stext = getGUI()->addStaticText(L" ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 ",
        rect<s32>(50,50,350,75),false,false,0,true);

stext->setBackgroundColor(SColor(255,128,0,0));
stext->setOverrideColor(SColor(255,255,255,255));
Output from revision 1422:
Image
Output from revision 1424 (up to the latest):
Image

Notes:
  • This only happens under OpenGL.
    Happens on both Widows & Linux.
    If setBackgroundColor() is commented out, the text appears correctly.
Debugging lead me down into COpenGLDriver::setRenderStates2DMode where I quickly became dizzy and then resurfaced to let the experts figure it out.

Posted: Mon Aug 11, 2008 5:47 am
by pc0de
Additional testing and notes:

The images in the first post aren't using Irrlicht's default font. Instead, it uses a font named "tdeffont" located in this file: defaults.zip.

Code for loading the font:

Code: Select all

getFileSystem()->addZipFileArchive("defaults.zip");
m_defaultFont = getGUI()->getFont("tdeffont.xml");
if(m_defaultFont)
{
    m_defaultFont->grab();
    getGUI()->getSkin()->setFont(m_defaultFont);
}
m_monoFont = getGUI()->getFont("monospace.xml");
if(m_monoFont)
    m_monoFont->grab();
If I don't load the above fonts, the output appears correctly using the default font:
Image

If I set the default skin font to "m_monoFont", it also appears correctly:
Image

Thinking that the problem may be related to the font I'm using, I modified another app to use Irrlicht's default font. This application loads several meshes and textures. Initially the static text appeared fine, but after moving the camera to view the different scene nodes, the static text changed to look semi-transparent similar to the screen shot in the first post: (right side pasted in)
Image

Sometimes it would switch back to looking correct, but not consistently.

Posted: Fri Aug 15, 2008 7:03 am
by merovingian
Just thought I'd chime in with a "me too" post.

I have recently started building my own Irrlicht DLL from the SVN truck. I checked-out revision 1489. My application looks fine when using Direct X, but I have the same faded look to the text when using OpenGL (under Windows in both cases - I haven't checked under Linux). Irrlicht 1.4.1 does not exhibit the problem, so it's a recent change.

Image
Image

I'm using the fonthaettenschweiler font that is distributed with Irrlicht. What I have noticed is that if I remove the Irrlicht logo from the bottom right hand corner, the text is fine. I say this like its significant, even though I have no idea how.

As you may also notice, I have the bonus problem that, under OpenGL, my Load-Haul-Dump vehicle mysteriously disappears from the RTTs in the top corners, but its lighting remains. I guess that's a topic for another thread, but given that the OpenGL RTTs are still suffering from the problem of being flipped, the situation with OpenGL RTTs is going from bad to worse. Sadly the problem remains even if I get rid of the Irrlicht logo. That dang logo, why can't its behaviour be consistent?

Posted: Tue Aug 19, 2008 1:08 pm
by hybrid
Ok, I've fixed the font problem in revision 1503. It was a missing texture property, which lead to a bilinear interpolation for the font. This wasn't intended, though.
The RTT problem is a different one. Please repost in another thread (including the images) and provide also some code how you're drawing the minimaps.

Posted: Wed Aug 20, 2008 5:18 am
by pc0de
Thanks. The text part is now working fine.

In one of my tests, the background portion of the static text flickers when the app starts up and then disappears after a couple of seconds...

I'll post back if I can eliminate it being related to my app code.

Posted: Thu Sep 04, 2008 7:25 am
by merovingian
hybrid wrote: The RTT problem is a different one. Please repost in another thread (including the images) and provide also some code how you're drawing the minimaps.
I'm sorry for not doing this, but today was my first visit to the forums since you posted your message.

Upon seeing your message, I updated to the latest trunk (1530) and I see that both the text and the RTT problem are fixed. I presume you are responsible for both, so many thanks for that.

OpenGL RTTs are still flipped, not that I was expecting that they wouldn't be. I know you're aware of that problem but AFAIK there is no specific bug thread for them. Is it helpful for me to create one?

Posted: Thu Sep 04, 2008 7:30 am
by hybrid
The RTT problem should have been solved for some month already. The texture coords are flipped, such that a draw2dimage should result in correct images even for RTTs. So I guess we need some code to reproduce this problem...

Posted: Fri Sep 05, 2008 5:02 am
by merovingian
I don't see any difference with 1530. My code is the same as it was when we first discussed the issue in April in the last 4 posts on the following page:

http://irrlicht.sourceforge.net/phpBB2/ ... highlight=

So my code should now be working? It works for DirectX.

If you think my code is OK, then I will make a new bug report thread.

Posted: Fri Sep 05, 2008 9:06 am
by hybrid
The fixes only happened in SVN/trunk, not in the 1.4 branch. Since I had to play with the texture coords I didn't want to corrupt the stable branch. But trunk definitely works, just tested it :D

Posted: Tue Sep 09, 2008 2:02 am
by merovingian
My Irrlicht build is a check-out of 1530 from the SVN trunk. So I am not sure where I've gone wrong. I just tried to look through the SVN log to see at what revision you made the fix, but didn't see any comment that immediately stood out - can you please tell me what source file (or files) have the fix, and what revision that file should be? So I can check whether I do indeed have the fix in my tree.

Posted: Tue Sep 09, 2008 7:11 am
by hybrid
The changes were made to the draw2DImage methods in COpenGLDriver.cpp in revision 1368:
r1368 | hybrid | 2008-06-12 14:00:41 +0200 (Do, 12 Jun 2008) | 1 line

Fixed draw2DImage methods for RTT usage under OpenGL.

Posted: Wed Sep 10, 2008 3:00 am
by merovingian
Thanks Hybrid. I definitely have the changes in my tree. But I still suffer the issue, it seems. I think I built my DLL correctly, so I am a little mystified as to where I've gone wrong.

Posted: Wed Sep 10, 2008 7:03 am
by hybrid
Ok, then please open a new thread and post some screenshots and code to reproduce the problem (try to use example 13 in order to avoid too much new code). Please also add this problem to the bug tracker on SourceForge: https://sourceforge.net/tracker/?atid=5 ... unc=browse