Archived

This topic is now archived and is closed to further replies.

SmiLeY1k2k

glTexCoord2f();

Recommended Posts

SmiLeY1k2k    122
Where can i find alot more detailed information about glTexCoord2f, cause i don''t understand them because i can never get the image where i want it , its always flipped and disorted. Thanks

Share this post


Link to post
Share on other sites
davepermen    1047
how about posting your code?
infos about how it works should be given in the nehe-tutorials more than enough.
before every glVertex call set the texcoord for the vertex you want to send to gl

we wanna play, not watch the pictures

Share this post


Link to post
Share on other sites
SmiLeY1k2k    122
This is the code. This bitmap is 512 x 512!
Also which is the best open gl book to buy, for at least $40?

glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
glBegin(GL_QUADS); // Draw A Quad

glTexCoord2f(1,0);
glVertex3f(-1.8f, 2.5f, 0.0f); // Top Left

glTexCoord2f(0,1);
glVertex3f( 4.8f, 2.5f, 0.0f); // Top Right

glTexCoord2f(1,0);
glVertex3f( 4.8f,-2.5f, 0.0f); // Bottom Right

glTexCoord2f(1,0);
glVertex3f(-1.8f,-2.5f, 0.0f); // Bottom Left

glEnd();

Share this post


Link to post
Share on other sites
davepermen    1047
glTexCoord2f(1,0);
glVertex3f( 4.8f,-2.5f, 0.0f); // Bottom Right

glTexCoord2f(1,0);
glVertex3f(-1.8f,-2.5f, 0.0f); // Bottom Left

the last two vertices do have the same texcoords..
i guess one of those two should have glTexCoord2f(1,1)
try out

and, if the image is flipped, try to swap those coordinates..
for example swap all first coordinates of glTexCoord3f(a,b) //in this case: a, means 0 to 1, and 1 to 0

try the different ways till you find yours..
thats the way i learned it.. and .. not to feel good, but i think i know some stuff of gl now..

PerPixelLighting

at least the texcoords work in this demo


oh, i guess you could try the redbook, you can find it online, link is on nehe's page..
web has enough good info for you, you don't have to pay (except the connection-bills)

EDIT:i hate those different forum-standards.. no automatical link detection here..

[edited by - davepermen on March 17, 2002 5:02:57 PM]

Share this post


Link to post
Share on other sites