PDA

View Full Version : Streching a texture over multiple triangles?



Kiamo
09-24-2001, 12:39 PM
I have a large (512x512) texture I want to display over my terrain, but it draws per triangle so it appears very small and tiled. How would I strech it out to get the full effects of its large resolution so it doesn't look so tiled?

Turrican
09-24-2001, 01:24 PM
Look at the NeHe lesson nr. 10(nehe.gamedev.net).

I had exactly the same problem 2 days ago.
http://www.opengl.org/discussion_boards/ubb/biggrin.gif

chrisATI
09-24-2001, 05:37 PM
Originally posted by Kiamo:
I have a large (512x512) texture I want to display over my terrain, but it draws per triangle so it appears very small and tiled. How would I strech it out to get the full effects of its large resolution so it doesn't look so tiled?

The texture coordinates you specify determine where opengl picks the sample points in the texture. For example if you want the upper left 10% of the texture then you would use the coordinates: (0.0, 0.0) (0.0, 0.1) (0.1, 0.1)

Texture coordinates are scaled such that the textures width and height are 1.0 unit in length. If you want some size smaller than the full length choose some number smaller than 1.0 but if you want the texture to repeat then choose a number greater than 1.0 (ie. 5.0 would repeate five times in the specified direction).

Bob
09-24-2001, 11:14 PM
>>For example if you want the upper left 10% of the texture then you would use the coordinates: (0.0, 0.0) (0.0, 0.1) (0.1, 0.1)

Isn't that the lower left corner? http://www.opengl.org/discussion_boards/ubb/tongue.gif

chrisATI
09-25-2001, 08:52 AM
Originally posted by Bob:
>>For example if you want the upper left 10% of the texture then you would use the coordinates: (0.0, 0.0) (0.0, 0.1) (0.1, 0.1)

Isn't that the lower left corner? http://www.opengl.org/discussion_boards/ubb/tongue.gif[/B]

doh! http://www.opengl.org/discussion_boards/ubb/smile.gif i was thinking about d3d!

Tolga Dalman
09-25-2001, 09:10 AM
hmm, does anyone know, how to texturize automatically?
eg:
x-----x
| \ /|
| O |
| / \|
x-----x

i want to put a texture to a map tile with "x" as edge points. but i want to add another height value "o".
is there any opengl call, that does for me? an extension perhaps?

Kiamo
09-25-2001, 01:56 PM
My program uses a heightmap to generate the triangles, so I need it to know how to align the texture beforehand (I can't do glTexCoord for every triangle myself)...

ffish
09-25-2001, 05:54 PM
Look into glTexGen