Streching a texture over multiple triangles?

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?

Look at the NeHe lesson nr. 10(nehe.gamedev.net).

I had exactly the same problem 2 days ago.

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).

>>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?

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? [/b]

doh! i was thinking about d3d!

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?

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)…

Look into glTexGen