I am having issues loading textures onto the imported object.
For an example I am trying to put a sand texture on a rectangular mesh that I imported as a 3DS file in irrlicht. The sand texture is not loading properly onto the object. So I need a good tutorial or someone who can help and guide me smoothly through the process.
The texture:
The Result of trying to load it:
Here is the code that imports the object, sets position and loads an image on to it as texture
scene::IAnimatedMesh* mesh = smgr->getMesh("land.3ds");
scene::ISceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
node->setPosition(vector3df(-10,-10,-10));
node->setMaterialFlag(EMF_LIGHTING,false);
node->setMaterialTexture(0,driver->getTexture("sand.jpg"));
Would appreciate help.
Any good tutorials on handling textures?
Re: Any good tutorials on handling textures?
The placement of the texture on a mesh depends on the uv-texture coordinates. Those are values which tell on which position of the texture a vertex should be (0,0 left top, 1,1 right bottom of the texture). You do usually set those coordinates in your editor (for example uv-maps in Blender). Inside Irrlicht those are the TCoords variables inside S3dVertex (http://irrlicht.sourceforge.net/docu/st ... ertex.html). So in theory you could also code them in by hand.
Additionally you can also change the texture-placement with texture-matrices. But you mostly need that for effects (like scrolling a texture or scaling it after it was placed).
Additionally you can also change the texture-placement with texture-matrices. But you mostly need that for effects (like scrolling a texture or scaling it after it was placed).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm