Page 1 of 1

noob question -> Models not being displayed

Posted: Sat Nov 05, 2005 7:32 pm
by Guest
I have taken the example code for the Hello World application, and tried to place my own model in it. The model refuses to load and gives an error in the console box about how it failed to open the file. I have tripple checked, and the file and paths are absolutly perfect. What could be the problem?

Posted: Sat Nov 05, 2005 7:34 pm
by Guest
could we see the console? what format is the model? what os are you using?

Posted: Sat Nov 05, 2005 8:00 pm
by Guest
Alright, I just fixed the error where it refused to load the model (I was running from code::blocks, and the working directory was set up wrong), but now it is not showing the model at all. The model is in Direct X format (.x) and I am running WindowsXP.

Sourcecode:

Code: Select all

#include <irrlicht.h>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

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

int main()
{
        IrrlichtDevice *device = createDevice(  EDT_SOFTWARE,
                                                dimension2d<s32>(800, 600),
                                                16,
                                                false,
                                                false,
                                                false,
                                                0);
        device->setWindowCaption(L"ExampleApp");
        IVideoDriver *driver = device->getVideoDriver();
        ISceneManager *smgr = device->getSceneManager();



        IAnimatedMesh* crate_mesh = smgr->getMesh("Media/3d/general_objects/crate_1.x");
        IAnimatedMeshSceneNode* crate_node = smgr->addAnimatedMeshSceneNode( crate_mesh );
        crate_node->setMaterialFlag(EMF_LIGHTING, false);

        smgr->addCameraSceneNode(0, vector3df(0,30,-50), vector3df(0,5,0));

        while(device->run())
        {
            driver->beginScene(true, true, SColor(0,200,200,200));
            smgr->drawAll();
            driver->endScene();
        }
        device->drop();
        return 0;
}

Posted: Sat Nov 05, 2005 8:05 pm
by Guest
maybe this helps:

crate_node->setScale(vector3df(100.0f, 100.0f, 100.0f));

some x file models will be very small when loaded in irrlicht (i have to scale mine, too) so they are "invisible", if you scale them up they should be visible again.

and if you can still not see it:

crate_node->setPosition(vector3df(0.0f, 0.0f, 0.0f));

then its at the 0,0,0 point, otherwise it could be too far away for the camera


i hope this helped :)

Posted: Sat Nov 05, 2005 8:18 pm
by Guest
I'm still getting nothing....
here is a screenshot of it all:

Image

Posted: Sun Nov 06, 2005 11:20 am
by bearSoft
'love' the empty form :) .. ok, if u use any of irr's 'default' meshes (like sidney) with -exact- the same code -what then?
if u see sidney then ur -own- mesh is someway 'wrong'
my -gues- would be that the normals are inverted or tansparency is total. experiment with another mesh/model -eg try and build one in a 3dbuilder like anim8tor (freeware and easy to use) or blender (less simple....but free too)