Code not working, please help !

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.
mark01
Posts: 32
Joined: Sat Sep 08, 2007 1:27 am

Post by mark01 »

like I said before and I say it again, without the do while loop like sudi did it it also stucks ! Thats the big problem.
The do while thing was only some experiment that doesnt make much sense I confess.

My guess was that perhaps its because of the picture is not erased (or does this occure automaticaly when the new scene is drawn?)
or perhaps because I have two Begin and End Scene Commands..

please help, Im really in trouble
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Post the actual code you're using, all you've given us is 2 snippets which may have code inbetween them that are causing problems.

Having more than one set of begin/end scene calls is not a problem, unless you're using them wrongly.
Image Image Image
mark01
Posts: 32
Joined: Sat Sep 08, 2007 1:27 am

Post by mark01 »

#include <irrlicht.h>
#include <iostream>
//#include <Clloadingbar.h>
//#include <loadscreen.cpp>

//#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")

using namespace irr;


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



int main()
{


bool shadows= true;

video::E_DRIVER_TYPE driverType;

driverType = video::EDT_DIRECT3D9;


// create device and exit if creation failed

IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(640, 480),
16, false, shadows);

if (device == 0)
return 1; // could not create selected driver.



video::IVideoDriver* driver = device->getVideoDriver();

scene::ISceneManager* smgr = device->getSceneManager();



/*
LOAD MESH
*/

scene::ISceneNode* node = 0;



//MY3D

// setting path to textures

device->getFileSystem()->addZipFileArchive("../00.HdM/tex/textures.zip");



// loading my3d mesh

scene::IMesh* mesh;


driver->beginScene(true, true, 0);


video::ITexture* titlescreen = driver->getTexture("../00.HdM/Hintergrund2.jpg");

driver->draw2DImage(titlescreen,core::position2d<s32>(0,0));

driver->endScene();

mesh = smgr->getMesh("../00.HdM/mesh.my3d")->getMesh(0);



//COLISSION



scene::ISceneNode* q3node = 0;

if (mesh)
//q3node = smgr->addOctTreeSceneNode(mesh);

q3node=smgr->addMeshSceneNode(mesh);

scene::ITriangleSelector* selector = 0;

if (q3node)
{
q3node->setPosition(core::vector3df(-1350,-130,-1400));

//selector = smgr->createOctTreeTriangleSelector(mesh, q3node, 128);
selector = smgr->createTriangleSelector(mesh, q3node);
q3node->setTriangleSelector(selector);
selector->drop();
}





scene::ICameraSceneNode* camera =
smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 0, true);
camera->setPosition(core::vector3df(-1050,50,-150));

scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();




//node = smgr->addOctTreeSceneNode(mesh->getMesh(0));



camera->setFarValue(15000);

// disable mouse cursor
device->getCursorControl()->setVisible(false);




int lastFPS = -1;

while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);

smgr->drawAll();

driver->endScene();

int fps = driver->getFPS();

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

device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}

device->drop();

return 0;
}
mark01
Posts: 32
Joined: Sat Sep 08, 2007 1:27 am

Post by mark01 »

ok, seems like the thing is working like that.. Had a Hardware Problem with my computer here so that it froze sometime while loading. On the other PC ive tried its working without problems
Post Reply