Texture Atlasing

Texture Atlasing

Released 5 years ago , Last update 4 years ago

Suitable for batching textures at run-time in a game or other hardware accelerated app.

Image atlases are needed for good app performance...

This is especially true on mobile GPUs, where draw calls are expensive. Texture batching is required to combine draw calls.

Speed prioritized over space efficiency

A new image comes in or an old one out, you can update atlases without dropping a frame (to the extent possible - this depends on other factors beyond the library's control.) This comes at the cost of space efficiency, but the trade-off is minimized.

Small and integrate-able

  • A single ~300 line .c file.
  • No external dependencies (outside of stdlib.)
  • C99
  • Small, well documented API.

The API is designed to play nice with language bindings (none provided.)

Pricing

14 day 14-day money-back guarantee

$29.99

Application License

  • Perpetual license

  • 1 application

  • Can distribute binary products only

  • Commercial use

  • 6 months support

Documentation

Here is an example of how you might use it with your rendering engine:

// Create a new atlas with 4 bytes per pixel.
// (4 for RGBA, 3 for RGB, 2 for RGB565 etc.)
struct atlas* atlas = atlas_new(4);

// Adding a new entry to the atlas is straightforward.
// You can look in atlas.h to see memory ownership rules and more detailed
// documentation on every function.
struct atlas_entry* entry = atlas_add_entry(atlas,
        data_width, data_height, raw_data,
        ATLAS_ENTRY_EXTRUDE_BORDER);

// ...


unsigned int w, h;
// Here is where the work happens. The entries are arranged and the final
// texture data is returned. You can query for any entries that the packing was
// not able to fit with `atlas_get_pack_failed`. See demo.c for an example.
uint8_t* packed_image = atlas_pack(atlas,
        MAX_TEXTURE_SIZE, MAX_TEXTURE_SIZE, &w, &h);

// MyAtlasedTexture would be your entry point for bridging the atlas output and
// your sprites. `packed_image` will be the same format as the entries you pass
// into the atlas.
MyAtlasedTexture texture = NewMyAtlasedTexture(packed_image, w, h);

unsigned int x, y;
// Getting the location of an entry you added earlier is also straightforward.
// How you hook up to your rendering engine beyond here is not within the scope
// of this library.
atlas_entry_get_packed_location(entry, &x, &y, &w, &h);
MyTextureSubRegion sub_region = NewMyTextureSubRegion(texture, x, y, w, h);
MySprite sprite = NewMySprite(sub_region);
DrawMySprite(sprite);

A simple example using SDL2 can be found in demo.c.

2 licenses, starting from From » $29.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
No comments have been posted yet.