Page 1 of 1

[fixed]IGUIStaticText Background Not Visible

Posted: Sat Aug 23, 2008 3:01 pm
by pc0de
I was able to isolate this problem (in revision 1510) outside of my framework code by creating a HillPlane with a transparent material:

Code: Select all

    SMaterial* mat = new SMaterial();
    ITexture* tex = m_videoDriver->getTexture("data/tex/grid.tga");
    mat->setTexture(0,tex);

    // causes static text background to disappear.
    mat->MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL;

    mat->setFlag(EMF_LIGHTING,false);
    mat->getTextureMatrix(0).setTextureScale(50.0,50.0);

    dimension2d<f32> tileSize(50,50);
    dimension2d<u32> tileCount(6,6);
    IAnimatedMesh* pmesh =
        m_sceneManager->addHillPlaneMesh("testHillPlane"
           ,tileSize,tileCount,mat);

    IAnimatedMeshSceneNode* pnode =
        m_sceneManager->addAnimatedMeshSceneNode(pmesh);
Without "mat->MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL":
Image

With "mat->MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL":
Image

As in this somewhat related post, it only happens when using OpenGL.

("grid.tga"link)

Posted: Sun Aug 24, 2008 11:52 pm
by Acki
no problems here, neither with DX nor with OGL...

Posted: Mon Aug 25, 2008 7:18 am
by pc0de
To be sure - you tested against revision 1510, right? If so, can you test with this application: idebug? Thanks.

Posted: Mon Aug 25, 2008 4:18 pm
by Acki
ohh, sorry, I was testing it with v1.4.1 :lol:

Posted: Mon Aug 25, 2008 5:57 pm
by drewbacca
pc0de, you've been posting a lot of great bug reports about very similar problems to what I have been having. Here is a temporary work around to your problem:

change your background color lines from:
stext->setBackgroundColor(SColor(128,0,255,0));

to

stext->setBackgroundColor(SColor(129,0,255,0));

There are a couple things going on. I think with some of the latest openGL changes, some states aren't being set properly, as a result your line with the material type is affecting your text backgrounds.

I don't have any reference to back it up, but i believe irrlicht has some checks where if something is transparent with an alpha value below some threshold, it doesn't get rendered at all. It looks like it doesn't get rendered if alpha <=128 in this case.

I was having a problem where I updated to the svn rev that fixed the gui being filtered in openGL and suddenly my driver->draw3dline() calls weren't working. It turned out I was using an alpha value of zero, which adjusting solved my problem. Something in those irrlicht changes started taking alpha into account with my 3dlines which had the default MaterialType parameter of EMT_SOLID.

Posted: Mon Aug 25, 2008 8:21 pm
by hybrid
Yes, correct. It's a missing update of the alpha test reference value. The default value for 3d material types is 0.5 as specified by the MaterialTypeParam (although I'll change this to 0.0 now, which is the actual value sent which is changed in the material renderers to 0.5). So since the alpha test is used, pixel values with alpha < reference are discarded...

Posted: Tue Aug 26, 2008 4:37 am
by pc0de
Thanks drewbacca, great catch!

And thanks to hybrid and Acki for their attention as well.

Posted: Tue Aug 26, 2008 8:37 am
by hybrid
Well, I should have added that the SVN has this bug fixed, it's not just fixed by workaround...

Posted: Wed Aug 27, 2008 1:36 am
by pc0de
yup, got that. just tested 129, 128, 127... it's all good.