How to set texture for a particular surface of a cube?

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
wsw1231
Posts: 148
Joined: Fri Oct 01, 2010 7:55 am

How to set texture for a particular surface of a cube?

Post by wsw1231 »

As we all know, there are 6 surfaces on a cube.
My question is how to let the program know which surface the user clicks on? and how to apply texture to that surface only?
grunt
Posts: 96
Joined: Tue Aug 17, 2004 9:14 pm
Contact:

Post by grunt »

I asked this like a week ago. They have to be in seperate meshbuffers. So in your modeling app, group each face seperately.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Or use UV mapping - like here
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
wsw1231
Posts: 148
Joined: Fri Oct 01, 2010 7:55 am

Post by wsw1231 »

grunt wrote:I asked this like a week ago. They have to be in seperate meshbuffers. So in your modeling app, group each face seperately.
Thanks for your advice.
However, I do not quite understand how meshbuffer works.
Would you mind sharing some of your code snippets with me?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

A meshbuffer is just a group of polygons (or vertices+indices to be more exact) which has a common material. So each time a part of your mesh needs another material (for example another texture) it needs to be put into an own meshbuffer. Take a look into CGeometryCreator.cpp in the Irrlicht sources for some examples how they are created.
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
Post Reply