Jump to content
  • Advertisement

Archived

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

Jesper T

texture positioning question

This topic is 6210 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!