Skip to main content
GameDev.net gamedev.net
🔒 Locked

glTexCoord2 error!

Started by masterviking Jun 30, 2006 at 8:58 AM 2 replies 1.3k views
Original Post
masterviking
masterviking
The "Red Book" says that glTexCoord2i should be used when you want to specify real texture coordinates! But it is clearly not true, when I give the arguments (0,20) it will repeat the texture 20 times! Please help! There must be a new function (the "red book" is old) that works fast, because if you first have to get the width, height, & then divide your real texture values by it -- it whould be slower & extra ugly code.
Please comment my english!
RobTheBloke
RobTheBloke
glMatrixMode(GL_TEXTURE);glPushMatrix();// scale the texture coords by 1.0f/(image_width-1)glScalef( 1.0f/(image_width-1),1.0f/(image_height-1), 1.0f );glMatrixMode(GL_MODELVIEW);// draw objectglMatrixMode(GL_TEXTURE);// return texture matrix to defaultglPopMatrix();glMatrixMode(GL_MODELVIEW);
masterviking
masterviking
Hmm.. Verry weird that one have to even touch the texture matrix! But this solution perfectly fits my code, thank you!
Please comment my english!
Brother Bob
Brother Bob
You should scale by 1/texture_width and 1/texture_height, not 1/(texture_width-1) and 1/(texture_height-1).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.