glVertex() Help!

Hi, I just wanted know what sort of values should I assign to the glVertex() so that the texture drawn is as the same height and width of the image being textured.
glBegin ( GL_QUADS );
glTexCoord2d ( 0, 0 ); glVertex2f (image_height3, 0);
glTexCoord2d ( 0, 1 ); glVertex2f (image_height3,image_width3);
glTexCoord2d ( 1, 1 ); glVertex2f ( 0,image_width3);
glTexCoord2d ( 1, 0 ); glVertex2f ( 0, 0);
glEnd ( );

I have tried assigning values like this but the textured image is not displayed properly.

Thanks for your time and help.


Maybe because in glVertex the call is
glVertex2f(width, height); and not the other way around. Anyway I don’t really see a problem, just make the dimensions of the quad analogous to the dimensions of the texture and you should be ok. Post again if you still have a problem.

…After some thinking: Try to think of the quad and the texture as two seperate things. For the texture to display properly you only need the same aspect ratio. Apart from that take care of your texture coordinates. The correct positions are (for a single quad):

(0.0, 1.0) ----------------------- (1.0, 1.0)
| |
| |
| |
| |
(0.0, 0.0) ----------------------- (1.0, 0.0)

So when you define your quad match the (s,t) texture coordinates with the vertex coordinates.

All of the above aplies if your image appears spatially distorted ofcourse. If you have a color problem or something like that then you should play around with the parameters “internal format” and “type” in the texture loading function glTexImage2D. Try to be more exact as to what the problem is.

Damn! The above shape should be a quad.