512 pixel pages, RGB565 format, 2 pixels of padding, border duplication PixmapPacker packer = new PixmapPacker(512, 512, Format.RGB565, 2, true); packer.pack("First Pixmap", pixmap1); packer.pack("Second Pixmap", pixmap2); TextureAtlas altas = packer.generateTextureAtlas(TextureFilter.Nearest, TextureFilter.Nearest); Note that you should not dispose the packer in this usage pattern. Instead, dispose the TextureAtlas if no longer needed. Incremental usage:
// 512x512 pixel pages, RGB565 format, 2 pixels of padding, no border duplication PixmapPacker packer = new PixmapPacker(512, 512, Format.RGB565, 2, false); TextureAtlas incrementalAtlas = new TextureAtlas(); // potentially on a separate thread, e.g. downloading thumbnails packer.pack("thumbnail", thumbnail); // on the rendering thread, every frame packer.updateTextureAtlas(incrementalAtlas, TextureFilter.Linear, TextureFilter.Linear); // once the atlas is no longer needed, make sure you get the final additions. This might // be more elaborate depending on your threading model. packer.updateTextureAtlas(incrementalAtlas, TextureFilter.Linear, TextureFilter.Linear); incrementalAtlas.dispose();
Pixmap-only usage:
PixmapPacker packer = new PixmapPacker(512, 512, Format.RGB565, 2, true); packer.pack("First Pixmap", pixmap1); packer.pack("Second Pixmap", pixmap2); // do something interesting with the resulting pages for (Page page : packer.getPages()) { } // dispose of the packer in this case packer.dispose();