开发者

Memory Usage - Large Images

开发者 https://www.devze.com 2023-03-17 17:19 出处:网络
I\'m using Tiled to cut up my large images to save memory, but 开发者_如何学Cit uses the same amount? My image is 1986 x 1562 pixels in PNG format and that uses up 31MB of memory during gameplay. When

I'm using Tiled to cut up my large images to save memory, but 开发者_如何学Cit uses the same amount? My image is 1986 x 1562 pixels in PNG format and that uses up 31MB of memory during gameplay. When I use a tilemap it is 180 x 120 tiles in TMX format and uses 31MB. Am I just doing something wrong? I put the TMX file in my project along with the PNG file.

I don't understand. I will have about 10 images that size in my application. What should I do?


First, any iPhone older than 3GS has a max texture size of 1024x1024. Your game will crash on older devices. Second, OpenGL rounds up the texture size to the nearest power of two when creating textures. Your 1986x1562 textures are actually 2048x2048, which is 4 megs a pop.

That your app uses 31 megs after loading one texture is likely due to other factors. Unless you come back with a blank project that just loads one of those monstrous textures and still you've got 31 megs, I say it's something else.

What you should do is logically group your textures into multiple images of 1024x1024. And use Xcode's profiling tools to determine where the memory is going.

0

精彩评论

暂无评论...
验证码 换一张
取 消