PDA

View Full Version : ClanLib 0.9 Texture Packer



sphair
03-04-2009, 02:35 PM
ClanLib 0.9 has a utility which loads a resource file, and packs all the sprite graphics it can find into a set of tightly packed textures, and writes the result to a new resource file.

Here is an example of loading all the 158 images used in ClanGUI, and how the resulting packed texture looks like:
http://esoteric.clanlib.org/~sphair/texture_packer6.png

This really helps performance, as the ClanLib now can batch all the sprite drawing commands efficiently, as it won't have to change the texture state.

BinarySpike
04-24-2009, 11:07 PM
This is impressive, does this create an definitions file? Aka an XML file that defines where all the different textures are loaded on the image? If you don't get the boundaries correct then you have problems.

I'm still using 0.8 because I need as much stability as possible. I should probably test 0.9 out though.

*edit*
I wrote a similar command line app when I used only SDL that did the same thing, however it was severely limited.

sphair
04-25-2009, 12:34 PM
It loads a ClanLib resource file (xml), which consists of any number of individual images. Then it packs them into one or more textures (depending on if they fit within the selected texture size), and then dumps out new texture PNGs together with a new Resource XML with the proper locations.

Ichoris
05-15-2009, 05:24 AM
Does this tool retain the alpha transparency? For my purpose I need the alpha to be kept when writing the combined file.

Is there somewhere I can get a compiled .EXE of the tool? I can't seem to make one that will compile myself.

Thanks!

sphair
05-15-2009, 05:45 AM
Yes, it handles alpha values.

We will probably not provide executable for this. The tool was coded to enable us to pack our GUI textures. It will work for all generic cases, but the UI isn't complete and there is no option to actually select which resource file to convert yet. You have to change the code in MainWindow::load_resources() for that.

What kind of compilation problems do you get? If you have a working ClanLib 2.0.x it should compile. If not, tell us the details.