Can anyone help me with texture mapping?
Do I understand it correctly that:
- you need to define new UV-coords for every triangle?
(which does not sound entirely stange to me)
- you need to define 4 sets of coordinates per triangle?
(Why is that? Why not just three)
So if I have four triangles, for example, I would need to define 4x4=16 sets of UV coords?
Texture mapping
Well one texture image has 4 coordinates, in Direct3D its as follows:
topleft = (0.0, 0.0)
topright = (1.0, 0.0)
bottomleft = (0.0, 1.0)
bottomright = (1.0, 1.0)
The texture is then mapped over the model where each vertex on the model has UV coordinates within the image (which is why a model has one texture, not one per triangle), ranging from 0.0 to 1.0 on each axis. The exact center could be specified with (0.5, 0.5) for example. Heres a link that may explain things a little better:
http://www.thehavok.co.uk/scene/32bits/ ... apping.php
It may be worth noting that in OpenGL things are different, and the coordinates are different:
topleft = (0.0, 1.0)
topright = (1.0, 1.0)
bottomleft = (0.0, 0.0)
bottomright = (1.0, 0.0)
topleft = (0.0, 0.0)
topright = (1.0, 0.0)
bottomleft = (0.0, 1.0)
bottomright = (1.0, 1.0)
The texture is then mapped over the model where each vertex on the model has UV coordinates within the image (which is why a model has one texture, not one per triangle), ranging from 0.0 to 1.0 on each axis. The exact center could be specified with (0.5, 0.5) for example. Heres a link that may explain things a little better:
http://www.thehavok.co.uk/scene/32bits/ ... apping.php
It may be worth noting that in OpenGL things are different, and the coordinates are different:
topleft = (0.0, 1.0)
topright = (1.0, 1.0)
bottomleft = (0.0, 0.0)
bottomright = (1.0, 0.0)
Mark my words, when you least expect it, your uppance will come...

