Jump to content
  • Advertisement
Sign in to follow this  
SharQueDo

Select source x,y,w,h

This topic is 4614 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

Advertisement
If you're mapping it to a sprite, just set the texture coordinates up correctly:



// TW = Texture Width (512.0f)
// TH = Texture Heigth (512.0f)

glBegin(GL_QUADS);
glVertex3f(0, 0, 0);
glTexCoord2f(64/TW, 32/TH); // top left

glVertex3f(1, 0, 0);
glTexCoord2f(96/TW, 32/ TH); // top right

glVertex3f(1, -1 , 0);
glTexCoord2f(96/TW, 64, TH); // bottom right

glVertex3f(0, -1, 0);
glTexCoord2f(64/TW, 64, TH); // bottom left

glEnd();

Share this post


Link to post
Share on other sites
Quote:
Original post by SharQueDo
That must be the most crappiest post ever... Any chance you would feel like posting a function about it here????


No, the post answered your question competely.

Its all a matter of texture coordinates, something you should take the time to larn and understand yourself.

Share this post


Link to post
Share on other sites
besides u asked if it was possible!

Some PPL want to solve the stuff them selves but dont want to shoot for something that is impossible so they just ask if it is possible

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!