Archived

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

Jesper T

texture positioning question

Recommended Posts

Im using a 256x256 texture in a GL_QUAD thingy.. I know how to map the texture onto the quad, but I am trying to map the quad with parts of the texture only ( eventually making the texture cover several quads ) I tried to change the values in the glTexCoord2f() but then suddenly the entire quad became mapped with one color instead of the part of the texture i wanted to cover it... so the question is: is the way im trying to do this possible at all, or do i have to split up the texture to make it work ??

Share this post


Link to post
Share on other sites
you have to set the texture coordinates for your verticies so that they don''t use the whole texture. Tex. coords are in the range of 0.0 - 1.0 so if you have a texture coord of 1.0, it means the 256th pixel on your texture map. using this, if you want a quad with only a 4th of the texture you could put the coords to

0.0, 0.0
0.0, 0.5
0.5, 0.5
0.5, 0.0

I suggest playing around with this idea and you should get it to work the way you want.

Share this post


Link to post
Share on other sites