possible bug?

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
Podunk
Posts: 8
Joined: Sat Oct 08, 2005 12:42 am

possible bug?

Post by Podunk »

first I'd like to say, this engine of yours is AWESOME, I don't know what I would do without it ... literally haha

Ive been tinkering with my first program using irrlicht :D and i realize that im dropping the node before my main loop

any help is greatly appreciated, thanks :)

here is the main loop in my program:
Image

Code: Select all

#include <irrlicht.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
//#include <string.h>
//#include <string>

using namespace irr;

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

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





IAnimatedMeshSceneNode* addMesh(ISceneManager *,IVideoDriver*, char[], char[], f32[], f32[]);

int main()
{
	IrrlichtDevice *device =
		createDevice(EDT_DIRECTX9, dimension2d<s32>(640, 480), 16,
		false, false, false, 0);
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	// make my node 
	f32 position[] = {0,0,0};
	f32 rotation[] = {0,0.3f,.3f};
	IAnimatedMeshSceneNode * myNode = addMesh(smgr,driver,"test.3DS","brkweat.jpg",position,rotation);
	myNode->drop();


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

	while(device->run())
	{
		driver->beginScene(true, true, SColor(255,100,101,140));
		smgr->drawAll();
		guienv->drawAll();
		driver->endScene();
	}
	device->drop();
	return 0;
};

IAnimatedMeshSceneNode* addMesh(ISceneManager* smgr, IVideoDriver* driver, char MeshFileName[], char textureFileName[], f32 position[], f32 rotation[])
{
	IAnimatedMesh* mesh = smgr->getMesh( MeshFileName );
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh,0,-1,core::vector3df(position[0],position[1],position[2]),core::vector3df(rotation[0],rotation[1],rotation[2]),core::vector3df(1,1,1) );
	if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		//add the texture file
		if (textureFileName != "")
            node->setMaterialTexture( 0, driver->getTexture( textureFileName ) );

		// add rotation animator
			scene::ISceneNodeAnimator* anim =
				smgr->createRotationAnimator(core::vector3df(rotation[0],rotation[1],rotation[2]));	
			node->addAnimator(anim);
			anim->drop();
		return node;
	}
	return false;
}

I R noob.
Please don't harp on me for asking noobie questions in the noob forum :P
Elise
Posts: 48
Joined: Tue Jul 19, 2005 6:30 am
Contact:

Re: possible bug?

Post by Elise »

Podunk wrote: Ive been tinkering with my first program using irrlicht :D and i realize that im dropping the node before my main loop
You should not drop scenenodes, instead use remove().
Podunk
Posts: 8
Joined: Sat Oct 08, 2005 12:42 am

Post by Podunk »

thank you :)
I R noob.
Please don't harp on me for asking noobie questions in the noob forum :P
Post Reply