Texturing At Runtime

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
ortsa
Posts: 11
Joined: Sun Jul 27, 2008 4:14 pm

Texturing At Runtime

Post by ortsa »

Hi everyone,

What i need is to be able to load a model and then be able to texture it at runtime, and be able to change the textures of certain elements of the 3d model at the click of a button.

Im not too sure about how to do this, so i thought i may aswell ask for your help.

Thanks A Lot.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: Texturing At Runtime

Post by rogerborg »

ortsa wrote:What i need is to be able to load a model and then be able to texture it at runtime
examples/01.HelloWorld/main.cpp

Code: Select all

node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
ortsa wrote:and be able to change the textures of certain elements of the 3d model at the click of a button.
A particular model - or more specifically a particular C/SMeshBuffer - can only have one material at a time, so you'll have to load multiple models and/or create multiple SMeshBuffers in order to achieve this.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

the problem with setMaterialTexture is that it sets the texture for all mesh buffers...
if you have (for example) 3 mesh buffers each with a different texture and you use setMaterialTexture on the node than all 3 mesh buffers get the same texture...
this also belongs to setMaterialFlag and setMaterialType...

but I added new functions with my IrrExtesnions so you now can set/get the texture, flags and type for each mesh buffer easily:
get/set material for each mesh buffer

with this you can now, for example, make only a part of the node transparent and not the whole node... ;)
of course you need to know which mesh buffer you want to change then...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply