Rendereing scene like in tutorial 2

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
Pumpkinpino
Posts: 3
Joined: Thu Dec 11, 2008 12:57 am

Rendereing scene like in tutorial 2

Post by Pumpkinpino »

Hello, I am facing a few problems when trying to render a scene with a first person camera and a model I created. The code is below.

The code below renders a gray scene with a black model(ss is below), but for some reason, the model is incomplete. I imported the .3ds file back into 3dsmax to make sure I exported it correctly, and the entire model is there. Wondering if it has something to do with the code (which seems unlikely to me)

http://img296.imageshack.us/my.php?image=renderzt0.png

Also to check if the results I am getting are correct for the model that is there, when using "node->setMaterialFlag(EMF_LIGHTING, false);" should the model then just be a flat gray color (a bit darker than the background so it is still visible)

Code: Select all

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

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

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif


int main() {

	IrrlichtDevice *device =
                createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480));

       
video::IVideoDriver* driver = device->getVideoDriver();
        scene::ISceneManager* smgr = device->getSceneManager();
		

 device->getFileSystem()->addZipFileArchive("C:\\Documents and Settings\\Greg Computer\\Desktop\\city.zip");

  scene::IAnimatedMesh* mesh = smgr->getMesh("city.3ds");
        scene::ISceneNode* node = 0;
        
        if (mesh)
                node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 128);

  if (node)
                node->setPosition(core::vector3df(-1300,-144,-1249));
	

smgr->addCameraSceneNodeFPS();

device->getCursorControl()->setVisible(false);

  int lastFPS = -1;

        while(device->run())
        {
                if (device->isWindowActive())
                {
                        driver->beginScene(true, true, video::SColor(255,200,200,200));
                        smgr->drawAll();
                        driver->endScene();

                        int fps = driver->getFPS();

                        if (lastFPS != fps)
                        {
                                core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
                                str += driver->getName();
                                str += "] FPS:";
                                str += fps;

                                device->setWindowCaption(str.c_str());
                                lastFPS = fps;
                        }
                }
                else
                        device->yield();
        }
   
		device->drop();
        return 0;
}
-greg
jontan6
Posts: 278
Joined: Fri Jun 13, 2008 5:29 pm

Post by jontan6 »

maybe it wasnt able to load the textures. did you place them in the same directory as the 3ds?
nathanf534
Posts: 199
Joined: Tue Dec 09, 2008 2:55 am

Post by nathanf534 »

most textures are stored as relative to the model, try to make sure the textures are in the right folder. Also, you could use irredit to place all your models onto a map, and assign textures to them, and then load the .irr scene into irrlicht.
while(signatureEmpty){cout<<wittyComment();}
Pumpkinpino
Posts: 3
Joined: Thu Dec 11, 2008 12:57 am

Post by Pumpkinpino »

Sorry if I was unclear, but what I meant to say was that the actual model is incomplete. What you see in the screen shot is a quick model of a castle, but what accompanied that was a city right next to it which never got loaded. They were all in the file city.3ds.

I fixed the problem by just importing the .3ds file back into 3dsmax (all the content was there) then just exported it again. From what saw, I believe that for whatever reason importing a file into another scene in 3dsmax then exporting both the native model in that file and the imported one was confusing irrlicht.

Thanks for all the input.
Post Reply