Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Image sheet calls and memory
Started by sporkfin Nov 11 2019 12:29 PM

3 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 663 posts
  • Corona SDK

Before I run some test I'm wondering if anyone knows how Corona handles multiple sprites calling the same image sheet - as in they each call the same sheet from scratch.

 

I have a custom sprite module where every sprite calls a new image sheet that might be identical the previously called image sheets. 

 

I'm now using hundreds of sprites instead of a handful and wondering if calling the same image sheet multiple times will increase the texture memory or if Corona "knows" that they are identical somehow and, thus, prevents texture bloat.

-- every time I make a sprite it calls its own image sheet
local spriteInfo = {-- my sprite info}
 
--  "sheet" and "sheetInfo" are loaded from a table
local myImageSheet = graphics.newImageSheet( "spritesheet/"..sheet..".png", sheetInfo:getSheet(name) )
local mySprite = display.newSprite( group, myImageSheet , spriteInfo)
 



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,020 posts
  • Corona SDK

If I'm not mistaken, each texture is loaded once and cached, and this cached texture is used for other sprites, so the texture memory requirements shouldn't be affected.



[TOPIC: post.html]
#3

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 663 posts
  • Corona SDK

That's what I'm hoping!



[TOPIC: post.html]
#4

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 663 posts
  • Corona SDK

Oh, I just thought of something else.  If there are a bunch of references to an image sheet, it might be hard to control removing the image sheet (imageSheet = nil).




[topic_controls]
[/topic_controls]