What's wrong with my texture mapping?

I use texture mapping to do distortion effect of my program. However, the effect seems not uniform.
What are the correct flags I need to set?
original: [http://www.cs.ust.hk/~yvonne/gl/e1.jpg](http://www.cs.ust.hk/~yvonne/gl/e1.jpg)"
distorted: [http://www.cs.ust.hk/~yvonne/gl/e2.jpg](http://www.cs.ust.hk/~yvonne/gl/e2.jpg)"

I use texture mapping to do distortion effect of my program. However, the effect seems not uniform.
What are the correct flags I need to set?
original:
distorted:

Hi there,

Enable perspective correct texturemapping.

Thats all.

Regards,

LG

Is the distorted shape a square which is rotated in space or is it a flat object whose right vertices are pulled apart? For the latter there is no solution I think (I can be wrong).

This is not a perspective correction problem.

The polygons are not in perspective, the program is trying to apply a warp to the image using texture, it is failing because of it is not in perspective.

The solution is to use gltexcoord4* instead of gltexcoord2*, this will allow you to specify a 4th coordinate called ‘w’ which the hardware will use to weight the interpolation of the texture hardware and therefore avoid the kind in the image that you see. Start with a value of 1 for all coordinates and weight an edge based on relative length, that should do the trick.

Lgrosshennig, this is identical to perspective correction issues, but the key difference is the intent of the application and the way the triangle has been drawn.

another solution is to subdivide the polygon further. It’s linear texcoord interpolation problem, and if you make the linear segments smaller, then the error along them will be smaller, too.

cheers,
John

The whole image is one picture, I haven’t repeat anything in it. And I only make this in a 2D-application.

When I changed from gltexcoord2* to gltexcoord4*, I got the same results. I set all the 3rd parameter to 0 and all the 4th to 1. Is that what u mean?