Retina scaling on iPad

I’m not sure this is right…  My app uses a landscape layout only and this is my config.lua

application = { content = { width = 480, height = 800, scale = "zoomEven", fps = 60, imageSuffix = { ["@2x"] = 1.5 } }, }

On simulator iPhone (640x1136px) uses SD graphics but iPad 2 (or iPad mini 768x1024px) uses HD graphics. 

For a landscape app the width is irrespective and the @2x calculation should work from the height value (which is technically the width in landscape) and therefore iPad 2 on 768x1024px should fail this calculation as 1024/800 = 1.28 as opposed to 768/480 = 1.6.

Ideally, the @2x calculation should be orientation aware and work on the height set in config.lua (it should use width if portrait obviously).

This causes memory issues on older iPads that are memory constrained.  Can this either be fixed or is there a setting that allows manually configuring the @2x texture logic so I can check for iPad 2 resolutions and force them into using SD graphics?

An override to force SD or HD would be great!

Thanks

Adrian

What happens if you change from zoomEven to letterbox?

Hey Rob,

Apart from screwing up my UI and zoom levels it does not use @2x assets on iPad resolution

I get this on letterbox

canvas = 800,600 origin = -0,-60 scaling factor = 1.28

and this on zoomEven

canvas = 640,480 origin = 80,-0 scaling factor = 1.28

Not sure why that makes a difference when the scaling factor is the same?  I am calculating the scaling factor like this - found on this blog post

local deviceWidth = ( display.contentWidth - (display.screenOriginX \* 2) ) / display.contentScaleX print("scaling factor:", deviceWidth / display.contentWidth)

Thanks

Adrian

What happens if you print device.pixelWidth / device.actualContentWidth? (and the height variants)

in zoomEven

display.pixelWidth / display.actualContentWidth = 1.2 display.pixelHeight / display.actualContentHeight = 2.13

in letterbox

display.pixelWidth / display.actualContentWidth = 0.96 display.pixelHeight / display.actualContentHeight = 1.70

both width ratios are under 1.5 and both height ratios are over 1.5

dynamic image scaling does not work intuitively imo for landscape orientation  the calc: display.pixelWidth / display.actualContentWidth (as given here) assumes portrait orientation, while the more correct calc for landscape would be:  display.pixelHeight / display.actualContentWidth – which will be equivalent to the reciprocal of content scale:  1.0/display.contentScaleX.  it’s the latter value, not the former, that should (imo) when it exceeds your “1.5” would trigger your @2x images in landscape orientation.  (the root of the issue is that display.pixelWidth|Height are ALWAYS given in terms of portrait orientation)

What happens if you change from zoomEven to letterbox?

Hey Rob,

Apart from screwing up my UI and zoom levels it does not use @2x assets on iPad resolution

I get this on letterbox

canvas = 800,600 origin = -0,-60 scaling factor = 1.28

and this on zoomEven

canvas = 640,480 origin = 80,-0 scaling factor = 1.28

Not sure why that makes a difference when the scaling factor is the same?  I am calculating the scaling factor like this - found on this blog post

local deviceWidth = ( display.contentWidth - (display.screenOriginX \* 2) ) / display.contentScaleX print("scaling factor:", deviceWidth / display.contentWidth)

Thanks

Adrian

What happens if you print device.pixelWidth / device.actualContentWidth? (and the height variants)

in zoomEven

display.pixelWidth / display.actualContentWidth = 1.2 display.pixelHeight / display.actualContentHeight = 2.13

in letterbox

display.pixelWidth / display.actualContentWidth = 0.96 display.pixelHeight / display.actualContentHeight = 1.70

both width ratios are under 1.5 and both height ratios are over 1.5

dynamic image scaling does not work intuitively imo for landscape orientation  the calc: display.pixelWidth / display.actualContentWidth (as given here) assumes portrait orientation, while the more correct calc for landscape would be:  display.pixelHeight / display.actualContentWidth – which will be equivalent to the reciprocal of content scale:  1.0/display.contentScaleX.  it’s the latter value, not the former, that should (imo) when it exceeds your “1.5” would trigger your @2x images in landscape orientation.  (the root of the issue is that display.pixelWidth|Height are ALWAYS given in terms of portrait orientation)