[solve] texture over 2048 * 2048 split to multi texture or how can i handle this

[solve] texture over 2048 * 2048 split to multi texture or how can i handle this
0.0 0


Action game on development. currently testing on browser and wish to use JSB to iPhone app in the future.
My character has over 300 frames of actions. currently using a single sprite and set texture rect to focus on the correct ‘frame’
at first i have problem on iPhone 3G once the texture gone over 1024*1024. Not a problem, i don’t expect it to run on iPhone 3G.
Now the texture has reach another limit of 2048*2048. it will work on retina display devices, but i still want to add more frames (soon or later)

What should i do? i have couple of imagination here (don’t want to hugely modify my code just to test)

  • split the texture? (can 1 sprite load multiple texture? will there be delay when i swap texture on play?)
    currently using setTextureRect to call the fame, it is really smooth without delays
    also currently the sprite is child of batchNode (so multiple character using same texture draws faster)
  • just expend the texture source (canvas of the png) and hope device is getting better and better?


Hi Zax,

Q: can 1 sprite load multiple texture?
A: Yes, A sprite object can load multiple texture.

Q: will there be delay when i swap texture on play?
A: No, It doesn’t delay.

Best regards


Thanks David,
Just another question.
so if now i have 1 sprite with 1 texture and i use setTextureRect to display the correct ‘frame’
after i change to concept to 1 sprite with x texture.
i will create each texture with cc.SpriteFrame
and later sprite use setDisplayFrame to get the correct texture.
the only difference will be my sprite now can not be children of a batchNode

am i correct?


Yes, but another difference is that you need to manually create SpriteFrames, you can use tools to create SpriteFrames if you using multiple sprites with 1 texture.
and using multiple sprites with 1 texture has other benefits, for example: reduce http requests.

I propose that the role of the picture are grouped into one big texture, you can generate multiple big texture instead of one.

As long as the texture isn’t too large, it can work on most devices.


Thanks David,

i have no choice but to use 1 sprite with 2 * (spriteFrames + texture). disadvantage is give-up batchNode
or set different sprite for each texture, hide or display the correct texture sprite.

it just simply my png (texture) has grow greater than what the mobile device browser can handle. (just iPhone 4,5 tested so far)
so i don’t have much confident that JSB will work as well (because its the same device)
i have to actually split my big texture into 2 so the mobile device can be happy again.