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.
Texturing At Runtime
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: Texturing At Runtime
examples/01.HelloWorld/main.cpportsa wrote:What i need is to be able to load a model and then be able to texture it at runtime
Code: Select all
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
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.ortsa wrote:and be able to change the textures of certain elements of the 3d model at the click of a button.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
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...
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:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java