# Thread: Can I do this with glTexGen ???

1. ## 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 or , 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.

...philipp

2. ## Re: Can I do this with glTexGen ???

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.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•