Can I do this with glTexGen ???

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.


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.