PDA

View Full Version : texture maping bitmap over many triangles



Bart
02-17-2003, 02:13 PM
Hi all

how do I map a bitmap texture representing an orhto-rectified satellite image over many triangles representing a digital elevation map. Do I have to take care of calculating the texture coordinates correspoding to each vertex myself, or is there an easier method?

Cheers

DFrey
02-17-2003, 02:26 PM
You could calculate the coordinates if you wanted to. Or you could simply use plane projection texture coordinate generation.

Bart
02-17-2003, 02:34 PM
Oh, could you please elaborate a little more about the plane projection method of calculating the texture coordinates? I am an absolute beginner, please mind :-)

Cheers

DFrey
02-17-2003, 03:34 PM
You need to enable texture coordinate generation mode GL_OBJECT_PLANE for GL_S and GL_T. For GL_S, set p1 to some scaling factor that maps your object x space into texture coordinate s space. Do similar for GL_T, though obviously not using p1. The MSDN documentation on glTexGen is surprisingly fairly clear at explaining this particular tex gen mode.

Bart
02-17-2003, 03:51 PM
I think I got it.. thanks a lot !