Archived

This topic is now archived and is closed to further replies.

texturing of a cube with directx9

This topic is 5311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, I created a texture using triangle list. I would like to texture it. I can texture the first face but I have some difficulties to texture the others each face is built in this way 1|---|3 |\ | | \ | 0|__\|2 triangle 0 1 2 triangle 1 2 3 so for the first face I can see my texture for the point 0 u=0 and v=1 for the point 1 u=0 and v=0 for the point 2 u=1 and v=1 for the point 0 u=1 and v=0 but for the second face I use the points 2 and 3(of the picture above). my problem is how can I texture the second face if I already gave the coordinate texture of the points 2 and 3. I hope that my explanations are understandable. thank you for any help you can give!!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You want the same texture coordinates most of the time, as you''re continuing to texture the second triangle from the same place in the texture map that you finished the first triangle. If you want to jump to a new location in the texture you must duplicate the vertex with the same position, but different UVs.

Share this post


Link to post
Share on other sites
I don''t understand very well your answer. perhaps I wasn''t very clear. I try again.

My goal is to texture a cube.(4faces in fact -front, right, back, and left). I would like to apply my texture(a square of 256pixels * 256pixels) on each face.

5
1 3

4
0 2


above there is 2faces (0132 and 2354) made up of 4triangles(2 per face)

triangle 1 => 012
triangle 2 => 123 (is the order is right?)
triangle 3 => 234
triangle 4 => 354 (is the order is right?)

I use triangle list. I can apply my texture on the first face. but is it possible to apply a texture on the second face without to duplicate the vertex

thank you

Share this post


Link to post
Share on other sites
I have some difficulties to draw the cube. Imagine the 4 first vertices like a square

Front view

1----3
| |
| |
0----2

and put the point 4 and 5 on the right to see the right face.

right view

3---5
| |
| |
2---4

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ah, a cube, not just a box. Sorry. I blame the face that GameDev screws up ascii art.

No, you''ll have to duplicate vertices. In some cases you might be able to get away with U going from 0 to 1, then 1 to 2, then 2 to 3 (or 0 to 0.25, 0.25 to 0.50, 0.50 to 0.75, etc). In general though vertices need to be duplicated.

The cube is one of those simple examples that isn''t so simple because of texturing, AND because of normals for lighting. Most meshes don''t suffer from this too much, but the cube, as simple as it seems, is one of the extreme cases.

Share this post


Link to post
Share on other sites