D3D poly's

Started by
0 comments, last by GameDev.net 24 years, 7 months ago
In Quake, creating a large polygon (a rectangle or something) would mean two large triangles right? With that large poly, the textures are repeated instead of stretched across. How is this possible to do in D3D when all it does is stretch the texture across three or four points?
Advertisement
Hi !!

If you want a texture to repeat on the face, you just have to set different uv coors.

Normally in a face you have (if it's stretched to fit the whole face) these uv's:

Vertex 1 : 0,0
vertex 2 : 1,0
vertex 3 : 1,1

and for the other face

Vertex 1 : 1,0
Vertex 2 : 1,1
Vertex 3 : 0,1

Something like that. Now, if you want the texture repeated, just set them like that:

Vertex 1 : 0,0
vertex 2 : 3,0
vertex 3 : 3,3

and for the other face

Vertex 1 : 3,0
Vertex 2 : 3,3
Vertex 3 : 0,3

As you can see the u and v's are greater that 1. In this example the texture would be repeated 3 times across the face.

You can control what Direct3D shall be in such a case (u and/or v greater than 1=100%) with a SetRenderState !!
Sorry, I don't remember what exactely to use as the parameters (these are very hard to remember), just search you documentation for WRAP or CLAMP. By the way, Wrap mode (so, what you want) is the default of Direct3D, so at the moment don't care about SetRenderState.

Just set your UVs greater than 1 and everything should be ok.


Phillip

Phillip Schuster

This topic is closed to new replies.

Advertisement