Working with textures

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
Poganezz
Posts: 7
Joined: Fri May 19, 2006 6:49 am

Working with textures

Post by Poganezz »

Is it possible :
1. To scale, rotate, offset texture images
2. To apply up to 4-8 textures on one objects
3. Add textures with specific flags (add, multiply, substract, etc...)

Thanks.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

1. Yes, by doing it manually on the vertices.
2. You can apply as many textures per object as you want if you think of objects as meshes. Just split the mesh up into mesh buffers with different materials. If you think of 8 textures per face you have to use IrrSpintz version with 8 texture support.
3. There are some materials which do these things, but for more specific material properties you'll have to define your own scene node or material type.
Poganezz
Posts: 7
Joined: Fri May 19, 2006 6:49 am

Post by Poganezz »

hybrid wrote:1. Yes, by doing it manually on the vertices.
You mean moving and rotating the whole mesh?
hybrid wrote:2. You can apply as many textures per object as you want if you think of objects as meshes. Just split the mesh up into mesh buffers with different materials. If you think of 8 textures per face you have to use IrrSpintz version with 8 texture support.
Is there a standart example of working with mesh buffers?
Where can I download IrrSpintz?
hybrid wrote: 3. There are some materials which do these things, but for more specific material properties you'll have to define your own scene node or material type.
When I create my own material type, in what way I'll be able to change its final exterior?


Thanks
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

1. No, moving the mesh would no change the texture. Each vertex of the mesh holds it's position, but also the 2d texture coords. You can change these coods just as ordinary 2d image coords. E.g. if you scale all coords by 2 your whole mesh would be covered by 4 texture patches instead of just one (if the original texture was used in it's whole range from 0..1x0..1). Rotation calculations seem a little more complicated, but there are existing algorithm available on the net.

2. I think mesh buffers are not covered by the examples. Take a look at any of the mesh loaders in the Irrlicht source, most of them use mesh buffers.
Search for IrrSpintz in the project forum, there's a sticky thread on it with homepage etc.

3. You can use any feature of the graphic subsystem (OpenGL/DirectX) you want. Materials are basically setting up the parameters of those systems to draw your meshes as desired. You'll have to know both OpenGL and DirectX, though, in order to make your material portable.
Poganezz
Posts: 7
Joined: Fri May 19, 2006 6:49 am

Post by Poganezz »

1. It's clear. But how can I access texture coords?
2. Clear :)
3. Clear :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to get the mesh of your scene node and iterate over all mesh buffers contained in there. Each mesh buffer holds S3DVertex elements which have a texture coord you can edit.
Post Reply