NME: most efficient way to load a sprite sheet?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NME: most efficient way to load a sprite sheet?

Mihail Ivanchev
Hello, planning the architecture of a game here and wondering what the best way to create a sprite sheet would be. I know OpenGL is used as a backend on Android so I guess my sprite sheet images (pngs) would have to be power of two big. So I'm going to load one such image as an asset and must use it to create my actors. What would be the best way to create individual sprites from this image? Should individual sprites be power of two big as well? When are real OpenGL textures created in the backend?

Regards,
M. Ivanchev

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: NME: most efficient way to load a sprite sheet?

singmajesty
If you function within powers of two, you'll potentially save some memory  
overhead or have slight gains in performance.

You might be interested in trying the "spritesheet" library on haxelib,  
which uses separate BitmapData objects for each tile, then swaps them to  
create animation. This is faster than copyPixels, but does require a bit  
more memory.

As an alternative, either as a modification to the library or as your own,  
you can use TileSheets. They perform well when all of your graphics exist  
on the same tilesheet, but I haven't tested what it is like if you require  
multiple tilesheets for the same draw


On Wed, 05 Oct 2011 11:34:08 -0700, Mihail Ivanchev <[hidden email]>  
wrote:

> Hello, planning the architecture of a game here and wondering what the  
> best
> way to create a sprite sheet would be. I know OpenGL is used as a  
> backend on
> Android so I guess my sprite sheet images (pngs) would have to be power  
> of
> two big. So I'm going to load one such image as an asset and must use it  
> to
> create my actors. What would be the best way to create individual sprites
> from this image? Should individual sprites be power of two big as well?  
> When
> are real OpenGL textures created in the backend?
>
> Regards,
> M. Ivanchev

--
haXe - an open source web programming language
http://haxe.org