[fixed] gui element render problem

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.
Post Reply
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

[fixed] gui element render problem

Post by pc0de »

bug - 2927570

When a scene contains a mesh with a material that has a texture scale other than the default, the GUI element text doesn't render correctly when the mesh is in view. This happens using both the OGL and D3D devices.

HillPlaneMesh in view (ogl):
Image
Mesh out of view (ogl):
Image
d3d:
Image

This problems occurs on both the trunk & the 1.7 release branch. Test code to reproduce:

Code: Select all

static IrrlichtDevice*      m_device;
static IVideoDriver*        m_videoDriver;
static ISceneManager*       m_sceneManager;
static IFileSystem*         m_fileSystem;
static IEventReceiver*      m_eventReceiver;
static IGUIEnvironment*     m_gui;
static ICameraSceneNode*    m_camera;
static bool                 m_running=true;
static int                  m_capNumber=1;

void test8()
{
    SIrrlichtCreationParameters cp;
    cp.DriverType = EDT_OPENGL;
    //cp.DriverType = EDT_DIRECT3D9;
    cp.WindowSize = dimension2du(640,480);
    cp.Bits = 32;
    cp.Fullscreen = false;
    cp.Vsync = true;
    cp.Stencilbuffer = false;
    cp.AntiAlias = 0;
    cp.EventReceiver = new EventReceiver();
    cp.WindowId = 0;

    m_device = createDeviceEx(cp);
    if(!m_device)
        return;

    m_fileSystem = m_device->getFileSystem();
    m_videoDriver = m_device->getVideoDriver();
    m_sceneManager = m_device->getSceneManager();
    m_gui = m_device->getGUIEnvironment();

    m_camera = m_sceneManager->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
    m_camera->setPosition(vector3df(0,10,0));

    IGUIStaticText* stext = m_gui->addStaticText(L" ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 ",
        rect<s32>(50,100,350,125),false,false,0,false);
    stext->setBackgroundColor(SColor(255,128,0,0));
    stext->setOverrideColor(SColor(255,255,255,255));

    m_gui->addEditBox(L"Test edit box", rect<s32>(50,150,350,175));

    m_gui->addCheckBox(true, rect<s32>(50, 200, 350, 225),0,-1,L"Test CheckBox");

    SMaterial* mat = new SMaterial();
    mat->MaterialType = EMT_SOLID;
    mat->setFlag(EMF_LIGHTING, false);

    // problem doesn't occur if the scale defaults: (1.f,1.f).
    mat->getTextureMatrix(0).setTextureScale(2.0,2.0);

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

    while(m_device->run() && m_running)
    {
        m_videoDriver->beginScene(true, true, SColor(255,100,101,140));

        m_sceneManager->drawAll();
        m_gui->drawAll();

        m_videoDriver->endScene();
    }

    m_device->drop();
}
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hey, thanks for the test. It'S fixed now in Irrlicht 1.7
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Indeed it is. Thanks for the quick fix.
Post Reply