Tag Info

Hot answers tagged

1

Your hunch is correct. There must be external information mapping regions of the image to sprites. Even in your regular grid-based example, you lack some information like origin, collision extents, named identifier.


1

using a single vec4 uniform you can use arbitrary sized sprites: uniform vec4 spriteLoc;//x and y is the relative offset and z and w is the scaling factor varrying vec2 texCoord;//0-1 as you would without the atlas main(){ gl_fragColor = sampler2D(atlas, texCoord.xy*spriteLoc.zw + spriteLoc.xy); }



Only top voted, non community-wiki answers of a minimum length are eligible