All black?!?

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
Il_Drugo
Posts: 15
Joined: Fri Aug 18, 2006 1:57 pm

All black?!?

Post by Il_Drugo »

I'm using the MY3D exporter for MAX 7 and model is exporter with no errors, but when I load it into Irrlicht it appears all black, like it has no texture...but it has....

This is like my model (an arena map) looks like in 3d studio max:

http://www.mad4creation.com/concept/arena_max.jpg

and that's how it looks in Irrlicht:

http://www.mad4creation.com/concept/arena_irr.jpg

And that's the code of my application:

Code: Select all

#include <irrlicht.h>
#include <iostream>

using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

int main()
 {
	IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(1024, 768),32, false, true, false,0);	

    video::IVideoDriver* driver = device->getVideoDriver();
    scene::ISceneManager* smgr = device->getSceneManager();
    gui::IGUIEnvironment* env = device->getGUIEnvironment();
    driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);

	scene::IAnimatedMesh* mesh;
     mesh = smgr->getMesh("./media/mylevel.my3d");	

    scene::ISceneNode* test_scene = smgr->addOctTreeSceneNode(mesh->getMesh(0));
    test_scene->setPosition( irr::core::vector3df(0,0,0) );
    test_scene->setScale( irr::core::vector3df(2,2,2) );
    test_scene->setRotation( irr::core::vector3df(0,0,0) );
    
	scene::ISceneNode* skyboxNode = 0;
	skyboxNode = smgr->addSkyBoxSceneNode( 
		driver->getTexture("./media/irrlicht2_up.jpg"),
		driver->getTexture("./media/irrlicht2_dn.jpg"),
		driver->getTexture("./media/irrlicht2_lf.jpg"),
		driver->getTexture("./media/irrlicht2_rt.jpg"),
		driver->getTexture("./media/irrlicht2_ft.jpg"),
		driver->getTexture("./media/irrlicht2_bk.jpg"));

	SKeyMap keyMap[8];

	keyMap[1].Action = EKA_MOVE_FORWARD;
	keyMap[1].KeyCode = KEY_KEY_W;

	keyMap[3].Action = EKA_MOVE_BACKWARD;
	keyMap[3].KeyCode = KEY_KEY_S;

	keyMap[5].Action = EKA_STRAFE_LEFT;
	keyMap[5].KeyCode = KEY_KEY_A;

	keyMap[7].Action = EKA_STRAFE_RIGHT;
	keyMap[7].KeyCode = KEY_KEY_D;	

    scene::ICameraSceneNode* camera = 0; 
    camera = smgr->addCameraSceneNodeFPS(0,80.0f,300.0f,-1, keyMap, 8);
    camera->setFarValue (50000.0f) ;
    camera->setFOV(1.1f); 
    camera->setPosition(core::vector3df(0,50,0));
    camera->setTarget( core::vector3df(0,0,0)); 
    camera->setRotation(core::vector3df(0,0,0));

    device->getCursorControl()->setVisible(false); 
    
	f32 text_rot=0;

    int lastFPS = -1;
    while(device->run())
    {
        driver->beginScene(true, true, video::SColor(255,0,0,0));
        smgr->drawAll();
        driver->endScene();

		  int fps = driver->getFPS();

        if (lastFPS != fps)
        {
            wchar_t tmp[1024];
            swprintf(tmp, 1024, L"MY3D Mesh Loader Example - Irrlicht Engine v.0.10 (fps:%d) Triangles:%d", 
                fps, driver->getPrimitiveCountDrawn());

            device->setWindowCaption(tmp);
            lastFPS = fps;
        }
    }

    device->drop();    

    return 0;
}
what's wrong?
Saku
Posts: 158
Joined: Wed Jan 05, 2005 8:48 am
Location: Denmark

Post by Saku »

Its pretty simple - Disable lights on your model!

You haven't added any lights to the scene.
In stead of simply disabling lights on your models, you could try adding a light to your scene.
Choose what ever works best to you.

good luck
Call me Wice, Miami Wice!
Post Reply