[RESOLVED] image sprite bug?

Hey there,

I was just wondering…

I have an image sprite and two extra versions for it. my config.lua looks like this:

 imageSuffix = { ["\_hd"] = 1.5, ["\_sd"] = 0.1 },

It all works fine on all different iPhone devices. On a Samsung II Android Phone the sprite takes the _hd image. And it looks really ugly ( pixelled, blurry ). Even though I place it at a position which is divisible by four, made everything right when I created it ( using texture packer ).

However, if I leave the [_hd] suffix out (in config.lua), it grabs the _sd image instead of using the default picture. this doesn’t make a lot of sense to me.

I am a bit confused, can someone explain?

edit:

when I put this into my config.lua it doesn’t grab the _sd format:

[""] = 1,

weird, I thought Corona would to that automatically?

 

okay: basically my only problem is that the sprite doesn’t look good. it
takes the _hd (like every other image) but for some reason it doesn’t
scale nicely or whatever. it looks really rubbish :frowning:

(only on Android!)

So I thought mybe I can detect Android devices and then tell it which picture to load manually. Is there a way to call the newSprite() method without dynamically taking the “right” pictures (depending on scaling mode of config.lua ?)

We really can’t answer that without more details. What are the width and height settings that are being used by that device?

What is the Samsung model in question’s physical screen resolution?

Are you using the new imageSheet way of doing sprites or the old sprite.* APIs? (http://docs.coronalabs.com/api/library/sprite/index.html)

We can’t really help without all of that information.

Dear Rob,

Of course. I’m sorry. Well, first of all the image consists of 41 sprites, each with a size of 384 x 320.

That makes a hd pic of 2416px x 2416px. The low resolution pic is 1208px x 1208px.

I include it like this:

local logo, sheetInfo, sheet sheetInfo = require("data.img.sheets.logo3d") sheet = graphics.newImageSheet( "data/img/sheets/logo3d.png", sheetInfo:getSheet() ) local logoSD = { name="turn", start=1, count=41, time=1000, loopCount = 1, loopDirection = "forward" } logo = display.newSprite(sheet, logoSD) logo:setReferencePoint(display.TopCenterReferencePoint) logo.x = display.contentWidth / 2 logo.y = 32 if android() then local divisibleByFourX = functions.nextdivisible(display.contentWidth/2,4) local divisibleByFourY = functions.nextdivisible(32,4) logo.x = divisibleByFourX logo.y = divisibleByFourY end group:insert(logo)

sheetInfo.lua is a file created by Texturepacker. Regardless of using sheetInfo:getSheet() in the params or doing it manually, it doesn’t make any difference.

I’ve seen that all android devices I’ve testet with come up with this pixelled / blurry image in contrast to my apple devices.

My current Samsung’s max-texture size is 4096 MB. The display.contentScaleX factor results in 0.66…

I’ve realized that if I’m using only four pics (sprite size is 768px x 640px ) then it’s no problem. But as soon as I pack more into the sheet it doesn’t work anymore.

Really weird…

Edit:

Rob, I just discovered that I have to make an extra 1.5 version of the imagesheet. It works now. I’ve read that somewhere in the forum… I hope this will work out on other devices too…

okay: basically my only problem is that the sprite doesn’t look good. it
takes the _hd (like every other image) but for some reason it doesn’t
scale nicely or whatever. it looks really rubbish :frowning:

(only on Android!)

So I thought mybe I can detect Android devices and then tell it which picture to load manually. Is there a way to call the newSprite() method without dynamically taking the “right” pictures (depending on scaling mode of config.lua ?)

We really can’t answer that without more details. What are the width and height settings that are being used by that device?

What is the Samsung model in question’s physical screen resolution?

Are you using the new imageSheet way of doing sprites or the old sprite.* APIs? (http://docs.coronalabs.com/api/library/sprite/index.html)

We can’t really help without all of that information.

Dear Rob,

Of course. I’m sorry. Well, first of all the image consists of 41 sprites, each with a size of 384 x 320.

That makes a hd pic of 2416px x 2416px. The low resolution pic is 1208px x 1208px.

I include it like this:

local logo, sheetInfo, sheet sheetInfo = require("data.img.sheets.logo3d") sheet = graphics.newImageSheet( "data/img/sheets/logo3d.png", sheetInfo:getSheet() ) local logoSD = { name="turn", start=1, count=41, time=1000, loopCount = 1, loopDirection = "forward" } logo = display.newSprite(sheet, logoSD) logo:setReferencePoint(display.TopCenterReferencePoint) logo.x = display.contentWidth / 2 logo.y = 32 if android() then local divisibleByFourX = functions.nextdivisible(display.contentWidth/2,4) local divisibleByFourY = functions.nextdivisible(32,4) logo.x = divisibleByFourX logo.y = divisibleByFourY end group:insert(logo)

sheetInfo.lua is a file created by Texturepacker. Regardless of using sheetInfo:getSheet() in the params or doing it manually, it doesn’t make any difference.

I’ve seen that all android devices I’ve testet with come up with this pixelled / blurry image in contrast to my apple devices.

My current Samsung’s max-texture size is 4096 MB. The display.contentScaleX factor results in 0.66…

I’ve realized that if I’m using only four pics (sprite size is 768px x 640px ) then it’s no problem. But as soon as I pack more into the sheet it doesn’t work anymore.

Really weird…

Edit:

Rob, I just discovered that I have to make an extra 1.5 version of the imagesheet. It works now. I’ve read that somewhere in the forum… I hope this will work out on other devices too…