Object is black even though EMF_LIGHTING, false

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
lordadamson
Posts: 10
Joined: Sun Nov 29, 2015 6:49 pm

Object is black even though EMF_LIGHTING, false

Post 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;
 
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: Object is black even though EMF_LIGHTING, false

Post 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;
}
 
CuteAlien
Admin
Posts: 9693
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Object is black even though EMF_LIGHTING, false

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
lordadamson
Posts: 10
Joined: Sun Nov 29, 2015 6:49 pm

Re: Object is black even though EMF_LIGHTING, false

Post 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.
Post Reply