noob question -> Models not being displayed

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
Guest

noob question -> Models not being displayed

Post 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?
Guest

Post by Guest »

could we see the console? what format is the model? what os are you using?
Guest

Post 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;
}
Guest

Post 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 :)
Guest

Post by Guest »

I'm still getting nothing....
here is a screenshot of it all:

Image
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post 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)
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Post Reply