Jump to content
  • Advertisement
Sign in to follow this  
captainfreedom

OpenGL texture concatenation tool

This topic is 3593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm looking for a tool that will automatically arrange several images into a opengl compatible texture using a best fit algorithm and write the co-ordinates to a text file. Does anyone know if a tool like that exists?

Share this post


Link to post
Share on other sites
Advertisement
Not sure if this is what you want, but you could give it a try:
http://developer.nvidia.com/object/texture_atlas_tools.html

Rick

Share this post


Link to post
Share on other sites
Ok, I should have mentioned that I'm using opengl es.
Besides that, the nvidia tool assumes that the origonal textures are in power of two dimensions and does no proper bin packing.
The reason I want this is becuase I have a whole load of textures in non opengl compatible dimensions (i.e. 34 x 34 ) if I put each one in a seperate texture that will be a collosal waste, so the obvious solution is to pack them into one texture

Share this post


Link to post
Share on other sites
Do the fun task of making your own. What is probably the most obvious solution, but also very slow and not scalable at all is to, for each texture, start at 0,0 and try to stick it in, incrementing the position until it fits or you run out of places to put it.

A much more ideal solution is to use a binary tree to track the memory. First, get a rough guess on the size of the texture. You know it will have to be as wide and as tall as the widest and tallest textures, along with have at least the area of all textures combined. If you want to go for less runs to fit them all instead of smallest size, you can start a little larger, requiring the destination to have at least 125% of the area of the source.

Order your elements from largest to smallest, then start plopping them in. The solution for tracking the space that I found the most idea was using a binary tree. There is a great site out there on how to do this (though they did it for light maps I believe), but I can not remember the link. I'm sure plenty of people here know exactly what I'm talking about and can provide you with the link. ;)

I implemented a texture atlas for my 2d engine doing this, and the results were very pleasing. In very little time, I could fill up a 4096x4096 texture with very minimal amount of unused space. In case you do not want to make your own, I do want to mention that, besides the tool Spek posted, I have not seen very much out there that can help with this problem, but it is not a very hard task as long as you know the way to approach it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!