Re: Allocation of 2D space
Kenneth Russell <[email protected]>
| Newsgroups | gmane.games.devel.algorithms |
|---|---|
| Message-ID | <[email protected]> |
Mike Shaver wrote: > On Tue, Aug 11, 2009 at 3:41 PM, Brian Meidell<[email protected]> wrote: >> I'm looking for an algorithm to allocate 2d rectangles of different >> sizes from a larger 2d rectangle (small areas out of a large texture), >> while wasting as little space as possible without being insanely slow. > > Sounds like you want a texture atlas, so something like > http://www.gamasutra.com/view/feature/2530/practical_texture_atlases.php > might be a good start? If you're looking for a run-time rather than ahead-of-time algorithm, there's some Java code you could use as a start at http://kenai.com/projects/jogl/ in the JOGL SCM, under src/jogl/classes/com/sun/opengl/util/packrect/ . It divides the larger 2d rectangle into variable-size "levels" and allocates out of those levels, performing compaction as necessary. It's far from optimal but has been pretty well tested. -Ken ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ GDAlgorithms-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list