Question

I am working from the GLSprite sample code example. What I want to know is what do I need to do to the code to have it treat my texture as a sprite-sheet? The only modification I have done so far is to create a 256 x 256 png of 16 smaller images to be my frames. I have never worked with sprite-sheets before. Thanks for your help.

Was it helpful?

Solution

You need to adjust the texture coordinates to map the required sprite. Texture coordinates are normally normalised (0 to 1). Assuming you have a 4x4 grid of sprites, the first sprite would have texture coords of...

0, 0
0, 0.25
0.25, 0.25
0.25, 0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top