Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

bad argument #2 to 'newImageSheet' only on some devices
Started by NovaSoft Interactive Oct 22 2019 08:59 AM

2 replies to this topic

Best Answer Rob Miracle , 24 October 2019 - 02:46 PM

You are likely running into a texture size limit. On some older android devices, the max texture size is 1024x1024, then another set of Android devices have a limit at 2048x2048.  I don't know how your sheet is laid out, but if it's a single row, 168x18 is 3024px. If it's vertical 156x18 = 2808. So both dimensions are over 2048. Make sure none of the dimensions of your image sheet doesn't exceed 2048.

 

Rob

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

NovaSoft Interactive

[GLOBAL: userInfoPane.html]
NovaSoft Interactive
  • Observer

  • 2 posts
  • Corona SDK

Hey there, 

 

One of our users recently emailed us about a crash he was having on his Kindle. The error message that popped up is "bad argument #2 to 'newImageSheet' (for single frame size, 'options' table must contain valid 'width' and 'height' values)"

 

The problem is I was unable to reproduce this on any of my devices so I was wondering if I could get any expert opinions as to what could be going wrong. The code that causes the crash is this: 

local sheetData = {
	width=168,
	height=156, -- 156
	numFrames=18
	}
	local scene7Sheet = graphics.newImageSheet("scene7_sparks1__sheet.png", sheetData) -- This line crashes
	local scene7SequenceData = {{name="normal",start=1,count=18,loopCount=1,time=850}}

I can't seem to understand why it's crashing. I looked into using sheetContentWidth/sheetContentHeight in the docs, but don't think that's relevant since I handle scaling the animation after it's been loaded. 

 

Anyone encounter this issue? The user was using a Kindle Fire HD7, and he's the only one that had this issue

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,300 posts
  • Enterprise

  Best Answer

You are likely running into a texture size limit. On some older android devices, the max texture size is 1024x1024, then another set of Android devices have a limit at 2048x2048.  I don't know how your sheet is laid out, but if it's a single row, 168x18 is 3024px. If it's vertical 156x18 = 2808. So both dimensions are over 2048. Make sure none of the dimensions of your image sheet doesn't exceed 2048.

 

Rob



[TOPIC: post.html]
#3

NovaSoft Interactive

[GLOBAL: userInfoPane.html]
NovaSoft Interactive
  • Observer

  • 2 posts
  • Corona SDK

Hey Rob, thanks for your reply! My texture sheet is indeed a single row, so it probably did exceeded the max texture limit on lower end devices. I'll give it a shot by using multiple rows instead. 




[topic_controls]
[/topic_controls]