Texture mapping distortion :(

Hi everybody,
Im working with texture in opengl. I can upload texture to and object and everything looks great when doing it on a perfect quad or polygon but when working with a irregular polygon(not the same dimensions)I get a distorted texture :frowning:

I believe its something with texture coordinates with my polygon or something abut mipmaps?I kn ow that everything in opengl is made up from triangles,but how can I get rid of that distortion ?Should i have more texture coordinates?

Thanks

Umer

ohh osryy i added an image so you guys can see what am going through :frowning:

I guess this old page should help you :
http://www.xyzw.us/~cass/qcoord/

Hi ZbuffeR,
thanks for the link! I think Im understanding what is happening but im not totally sure how to make it work. I grab some code from the example in teh link were i think everything is happening but i got some questions about the code:
{
float tx = scale_texcoord * top;
glBegin(GL_QUADS);

	glTexCoord2f(-1, -1);
	glVertex2f  (-1, -1);
	
	glTexCoord4f(-tx,  tx, 0, tx);
	glVertex2f  (-top,  1);
	
	glTexCoord4f( tx,  tx, 0, tx);
	glVertex2f  ( top,  1);
	
	glTexCoord2f( 1, -1);
	glVertex2f  ( 1, -1);
	
	glEnd();

}

why is he just applying gltexcoord4f() only to the top points?what happens if you change the coordinates from the bottom?

Thanks for your help!

Umer.

Depending on how old is the OpenGL implementation you have available on your machine you may solve this issue with:

glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);

This is deprecated since 3.0.

Hi overlay,
I got opengl v2.1 . I do have that glHint() but nothing changes :(.
Do you have any sample about texture coordinates. Im still a bit confused about how the coordinates work [glTexCoord4f(s,t,r,q)]

again thanks everybody for the help :).

This is a prerequisite, but not sufficient, read again the cass page.

Hi ZbuffeR,

I read the cass page again but I cant make it work :(… Im confuse on how gltexcoord4f(s,t,r,q) works ! Im still getting that unpleasant image! I tried to copy part of his code but I got the same distortion ;(… Could you please help me with a sample about gltexcoord4f?

Again thanks for your time!

Did you run the demo provided on the page ?
Did it work ? If not, either your hardware/driver do not support this, or the demo is bogus.

EDIT: I compiled and the demo on Linux nivida, no problem here and works as advertised (had to remove a bunch of non-used lines from the glh_linear.h to make my compiler happy).

Hi ZbuffeR,
sorry couldnt post this before :frowning: Im still stuck in this, I mean ,I made the sample work… My problem is i cant totally understand glTexCoord4f(s,t,r,q)… The sample is fine when the top is the same value for each top coordinate. I want to put each one of the quad coordinates and have a irregular quad and map my texture into that polygon! Thanks for your time and Illw ait for your comments.