Jump to content
  • Advertisement
Sign in to follow this  
cebugdev

SDL Handling Sprites, resource and memory

This topic is 691 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

Hi all,

 

im having trouble with handling resources, i only have 69 sprite sheets for animations but i am getting "not enough memory" when converting a surface to texture during sprite loading. Im using PNG for my sprites along with the backgrounds and other stuff.

 

What advise can you guys give in handling this? will it make a difference if i use a different file format instead, like let's say a TGA instead of PNG?

i dont want to render and handle the sprites from CPU, as it will slow down the process like converting from surface to texture every frame or if needed.

 

what else can i do to handle this issue?

 

 

Share this post


Link to post
Share on other sites
Advertisement

1. What's the sizes of those spritesheets?

2. What's packed in single spritesheet?

3. Are they all visible on screen at the same time?

4. Any chances that you're leaking resources, by loading it periodically but not freeing?

 

will it make a difference if i use a different file format instead, like let's say a TGA instead of PNG?

 

That's external files format. Internally these formats will be unpacked into raw array of pixels, so there's no difference if you're using tga or png.

 

 

what else can i do to handle this issue?

Avoid loading data that won't be visible.

If spritesheet has animations for multiple characters - split it. Let every character have own spritesheet, so it can be loaded only if that character appears on screen, and unloaded when character goes out.

If your graphics allows it (in terms of visual quality), try to use compressed textures (DDS file with DXT1 compression and 1-bit alpha).

Otherwise consider reducing sprite sizes/resolution.

Edited by vstrakh

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!