Applying Texture to a Custom Scene Node

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
z4rd0z
Posts: 11
Joined: Sat Jan 12, 2008 9:11 am

Applying Texture to a Custom Scene Node

Post by z4rd0z »

Hi all,

I have a problem applying a simple texture to a custom scene node with irrlicht 1.4. I do not have this problem with Irrlicht 1.3.1. I use the OpenGL renderer under Linux.

How to get the problem:

* Add the "setMaterialTexture" line to the 03.CustomSceneNode irrlicht 1.4 tutorial:

Code: Select all

	// createRotationAnimator() could return 0, so should be checked
	if(anim)
	{
		myNode->addAnimator(anim);
		// I'm done referring to anim, so must drop this reference now because it
		// was produced by a createFoo() function.
		anim->drop();
		anim = 0; // As I shouldn't refer to it again, ensure that I can't
	}

        // This is the line to add (set diffuse texture)
	myNode->setMaterialTexture(0, driver->getTexture("../../media/012shot.jpg")); 

	// I'm done with my CSampleSceneNode object, and so must drop my reference
	myNode->drop();
	myNode = 0; // As I shouldn't refer to it again, ensure that I can't
* Build the sample and run it: the texture is not applied.

* Adding a myNode->setMaterialType(video::EMT_SOLID); line does not help.

* If I build/link the same code against irrLicht 1.3.1 the tetraeder is totally textured


So I suspect that I have to do something different in irrLicht 1.4 to get the same effect.

Can someone help me ?

Thanks in advance.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, the example has a bug. Simply make the getMateriaCount method const.
z4rd0z
Posts: 11
Joined: Sat Jan 12, 2008 9:11 am

Post by z4rd0z »

Ah yes, thanks for your prompt answer.

I just read the changes.txt file and I saw that I have to change some method signatures in my code to make a right usage of const. It explains why my project did not work anymore after irrlicht update.

Thanks again !
Post Reply