Page 1 of 1

Object is black even though EMF_LIGHTING, false

Posted: Wed Dec 02, 2015 9:39 pm
by lordadamson
the title says it all

Code: Select all

 
int main()
{
    IrrlichtDevice *device =
        createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
            false, false, false, 0);
 
    if (!device)
        return 1;
    device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
 
    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* smgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();
 
    guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
        rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh = smgr->getMesh("../../../dino2.dae");
    if (!mesh)
    {
        device->drop();
        return 1;
    }
    IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
 
    if (node)
    {
        node->setMaterialFlag(EMF_LIGHTING, false);
        node->setMD2Animation(scene::EMAT_STAND);
        node->setMaterialTexture( 0, driver->getTexture("../../../fedora23.png") );
    }
smgr->addCameraSceneNodeFPS();
while(device->run())
    {
        driver->beginScene(true, true, SColor(255,100,101,140));
 
        smgr->drawAll();
        guienv->drawAll();
 
        driver->endScene();
    }
    device->drop();
 
    return 0;
 

Re: Object is black even though EMF_LIGHTING, false

Posted: Thu Dec 03, 2015 2:43 am
by chronologicaldot
First make sure the material loads. You may have the wrong path specified.

Code: Select all

 
irr::video::ITexture* myTexture = driver->getTexture("../../../fedora23.png");
if ( !myTexture )
{
device->drop(); return 1;
}
 

Re: Object is black even though EMF_LIGHTING, false

Posted: Thu Dec 03, 2015 9:23 am
by CuteAlien
Also you should use another driver. EDT_SOFTWARE is mainly for doing settings dialogs. It can render a little bit 3D, but that's just an added features. Preferably you should work with EDT_OPENGL or EDT_DIRECT3D9. If you need software rendering for some reason then use EDT_BURNINGSVIDEO which supports more features.

And always check console messages, if for example the texture doesn't load it will give a warning there.

Re: Object is black even though EMF_LIGHTING, false

Posted: Thu Dec 03, 2015 12:51 pm
by lordadamson
Hey thanks. I managed to load the materials with a cube not sure what was wrong but I did it.
Now I'm struggling to get a mesh with armature to load animation. But I think that's an issue for a different post.
Thanks again.