View Full Version : Spreading a texture over multiple polygons

03-29-2002, 01:36 AM

I am just starting to learn OpenGL, and have started by writing a simple landscape engine that works by having each point on the heightmap represent a vertex in a quad.

Now, I have managed to texture each quad indivdually, but what I really want to do is have one big texture and spread it over the entire scene.

Can anyone help me?

03-29-2002, 03:52 AM
You need to set TexCoord2f(x, z); for every vertex. For the lower left for example TexCoord2f(0.0f, 0.0f); for the upper left e.g.: TexCoord2f(0.0f, 1.0f); lower right: TexCoord2f(1.0f, 0.0f); and so on. One image spans all over TexCoord from 0 to 1. If you want to have a picture over mor then one quad you should use values between 0 and 1. e.g.: TexCoord2f(0.3f, 0.2f);

I recommend you not using quads. you do better with triangles. believe me you got strange results when the 4 points lie not on a plane. The points of a triangle always lies on a plane!

I hope my english is readable, and i could help you :-)