Moved to Codeberg
Simple performant OpenGL sprite batcher written in odin, for drawing many sprites. I made this as a generic starting point for my OpenGL projects.
This renderer uses texture atlases to draw multiple different sprites with a single draw call.
- Initialise the renderer with
init_sprite_batcher - Create a
SpriteAtlaswithcreate_sprite_atlas(defer destroy_sprite_atlas).- Provide a filepath to the atlas.
- Define each sprite within the atlas by providing an array of
SpriteRegionDesc. Each region is defined by a start point and a size in pixels.
- Call
start_render_pass - Use
draw_spriteto draw a single sprite ordraw_spritesto draw a batch. Position and display data is provided by theSpritestructure.region_idis the index of a definedSpriteRegionon the atlas.
- Call
end_render_passto present the main framebuffer to the default one.
See the example for more detail.
This package is under the MIT License.