View Full Version : Can I do this with glTexGen ???

08-11-2005, 12:50 AM
Hi everybody,
I need to map a texture to a flat surface. The mapping of Texturespace to Objectspace is given by a mathematic formula (follows).
To get the coordinates in the Objectspace to which a point on the texture is mapped is calculated by the following formula:

X= ((1 + A*(sē+tē) + B*(sē+tē)ē ) *s + C ) * D
Y= ((1 + A*(sē+tē) + B*(sē+tē)ē ) *t + E ) * F

X,Y --> coordinates in ObjectSpace
s,t --> coordinates on texture
A,B,C,D,E,F --> constants (given at the beginning, they do not change)

No, donīt get all like :eek: or :confused: , this is actually a pretty easy calculation.

So, if you have a point on the texture, you can easily calculate the coordinates to which it will be mapped on the object.
I havenīt found a way to do it the other way round (coord. on object given, look up point on texture). Iīm not sure if itīs possible at all.

Iīve looked at glTexGen, but it only allows 4 parameters for the calculation. Or is there any other way ?

Thanks in advance.


08-11-2005, 07:30 AM
I don't think so.
TexGen uses linear, cubemap or spherical mapping.
What you have involves s and t to the 5th power.

Besides, the texgen happens per vertex, not per fragment. The interpolation is still linear.