# Select source x,y,w,h

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

## Recommended Posts

Is it possible to have a 512x512 tilesheet and just draw eg tile 18 (starts at 64,32, ends at 96,64)?

Yes.

##### Share on other sites
That must be the most crappiest post ever... Any chance you would feel like posting a function about it here????

##### Share on other sites
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)

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 on other sites
Quote:
 Original post by SharQueDoThat must be the most crappiest post ever... Any chance you would feel like posting a function about it here????

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

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

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 16
• 15
• 28
• 12
• 14
• ### Forum Statistics

• Total Topics
634805
• Total Posts
3019366
×