PDA

View Full Version : Can GLTexGen generate coordinates for a plane, but use an offset?



halo
12-19-2003, 06:35 PM
I'd like to generate coordinates for my dynamic lights using GLTexGen, but there doesn't appear to be any way to offset the coordinates. Since the texture is clamped, it is important that I have some way of specifying the lights source's 2D position relative to the plane. Is there any way to od this, maybe by a texture offset?

Also, the mapping changes with the camera, preumably because you are supposed to specify glTexGen before the camera movement. But if you have multiple plane equations you will be using, how is this any good?

If this is not possible, I was thinking I would store a set of 2D vertices that were transformed to the plane space, so that I wouldn't have to recalculate them each frame.

Thanks.

[This message has been edited by halo (edited 12-19-2003).]

[This message has been edited by halo (edited 12-19-2003).]

dorbie
12-20-2003, 03:06 AM
You can use the texture matrix to move the coordinates, however you don't need to because the 4th coefficient of the plane equation for each coordinate represents the offset for that coordinate allowing you to move each coordinates.

You can apply the texgen in OBJECT space or EYE space. EYE space will move with the camera. In addition you can apply model or inverse viewing matrix manipulations to the texture matrix to place in any space you like.

halo
12-20-2003, 10:44 AM
I don't mean the d# distance for the plane, because that will be irrelevant for 2D texture coords. I think I am going to just store a copy of the vertex positions in 2D space, relative to the plane, and calculate it myself, rather than rely on a bunch of commands I can't see the internal workings of.

Thanks.