Texture Coordinates

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
ElPeque
Posts: 4
Joined: Mon Aug 20, 2007 1:53 pm

Texture Coordinates

Post by ElPeque »

ive seen you can just create some model, and insert it somewhere in the nodegraph.

and you just set it to "some texture".

but can you tweak how that texture is applyed? :?

i mean, if you just add a triangle. how do you specify how a texture will be mapped to such triangle? (how do you set de tex-coordinates?)

and wether it will be clamped or repeated, and on which axis, etc.

Edit: And what if you want to use many textures on the same model?

like, for the dwarf example in the tutorials. in the 1st tutorial, i changed the woman's model with the dwarven model and its axe gets the same texture.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

how do you set de tex-coordinates?
Every vertex that you create or load has at least one set of texture coordinates. If you are manually creating vertices, then you must manually specify the texture coordinates of each vertex.
wether it will be clamped or repeated, and on which axis
The material has a EMF_TEXTURE_WRAP flag that you can use to control this. There is one flag per texture per material.
And what if you want to use many textures on the same model
You use mesh buffers. All vertices in a mesh buffer share the same material flags. The material flags includes textures, so those vertices use the same textures. If you want a group of vertices to use a different texture, then you create a new mesh buffer, set that mesh buffers material to the other texture, and you add vertices to that buffer.
i changed the woman's model with the dwarven model and its axe gets the same texture
That is because the axe material and vertices are stored in its own mesh buffer. This keeps them seperate from the vertices for the actual dwarf model.

Travis
ElPeque
Posts: 4
Joined: Mon Aug 20, 2007 1:53 pm

Post by ElPeque »

thanks, you've been very helpful :).

now i have to browse in the wiki or tutorials to find how i do all that XD.

thanks again :)
Post Reply