v11: project resolution 768x1024 gives 320x480 on iPhone4/iPod4

Previous topic - Next topic

BdR

In the new version GLBasic v11 there is a problem with apps that run on both iphone/ipad, and project resolution is set to 768x1024 (portrait). It correctly runs in 768x1024 mode on the iPad, even on the new iPad3 (which has 1536x2048 screen) so this is correct. However, the problem is that on iPhone4/iPod4 it incorrectly starts in 320x480 graphics mode. (btw this is a bug report, as suggested this topic)

Here's my new info:
GLBasic v11.261
libpng-gf.a => 14-dec-2012
libGLBasiciPhone-egl.a => 14-dec-2012

In project->options I set the Resolution to 768x1024. On an iPod4 my GLB app now runs in 320x480 mode. I've tried it on an iPod4, iPhone4 and an iPad3. I've even uninstalled both GLBasic v10 and v11, and then only re-installed v11. Console gives this output:

Code (glbasic) Select
init with frame.
desktop backing: 320 x 480
mainScreen: 320x480
glb_notify_screen_size 320x480
slaunch ok
-applicationDidBecomeActive    -> unpause
timer
rbow
rbow init
Rbow::SetScreen( 768,1024)
get accurate timer - 1st call
flip - 1st call
BGRA ext supported


Note that when I set the project settings to 640x960 and run it on my iPod4, then it does go to 640x960 ("retina") graphics mode. Here is the console output.

Code (glbasic) Select
init with frame.
App wants to support retina...
Retina scaleing available: self.contentScaleFactor = 2.000000
desktop backing: 640 x 960
mainScreen: 640x960
glb_notify_screen_size 640x960
slaunch ok
-applicationDidBecomeActive    -> unpause
timer
rbow
rbow init
Rbow::SetScreen( 640,960)
get accurate timer - 1st call
flip - 1st call
BGRA ext supported

BdR

I've been getting some bug reports from users who get my app in small screen size (1024x768 displayed on 2048x1536).

This issue is fixed for iPad with v11, but in turn this 'breaks' retina display on iPhone.. It's been a little quiet here, so I'm just wondering if there is a new v11 in the works..?

MrTAToad


BdR

I just downloaded the GLBasic v11.322 update hoping this will fix this iPhone 320x480 problem, but it still seems to be there. Question, do you (MrTAToad, Kitty) also get this behaviour, I mean is it reproducible on your end?

I get a lot of e-mails of users complaining that Snake Slider displays on a small part of the screen on their iPad. I *really* want to make an update but, like I already wrote here, that will break the 'retina' display for the iPhone/iPod. O_O

Kitty Hello

The silly thing is, I need to set the screen scaling before I create the screen.
So, here's my junkload of code:
Code (glbasic) Select

- (BOOL)createFramebuffer {
...
// iphone: 320x 480-> 640x 960
// ipad:   768x1024->1536x2048
#define max(a,b) ((a)>(b)?(a):(b))
if(max(dg_resx,dg_resy) == 960 || max(dg_resx, dg_resy) > 1024 ) // wants retina in iPhone4 or iPad3
{
printf("App wants to support retina...\n");
if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")])
{
if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")])
{
float use_scale = [[UIScreen mainScreen] scale]; // 1=iPod, 2=retina

self.contentScaleFactor = use_scale;
gMouseScale = use_scale;
printf("Retina scaleing available: self.contentScaleFactor = %f\n", use_scale);
}
}
}


do you have a better idea?

BdR

Aha! I think I understand the cause of my problem now.

Currently there are the following Apple devices:
ipod/iphone no retina (<=3G) ->  320 x 480
ipod/iphone retina (4G) -> 640 x 960
ipod/iphone retina (5G) -> 640 x 1136
ipad1/ipad2/mini -> 768 x 1024
ipad3 -> 1536 x 2048

There is some objective-c code missing, but the part you posted determines which one of these devices it is, retina or non-retina. It makes this destinction between the old devices where max(dg_resx, dg_resy) == 1024 and the new devices where max(dg_resx, dg_resy) > 1024 (namely 2048 for ipad3 or 1136 for iPhone5).

My Snake Slider project has a problem here, because it is 'universal' app and I want to support both the new iPhone4 and the old iPad2, but not the new iPad3 (because I don't have retina graphics files for 2048*1536, also the appsize would become huge). So, I have set the resolution for iPhone in project options to 768 x 1024 (='old ipad2'). On the new iPad I want it to use 1024*768 and use a scale factor (which works correct now in v11). However, I thought this would also "encapsulate" the new iPhone (640x960) resolution but apparently it doesn't.

So, I think using the following code would fix this problem:
Code (glbasic) Select
//if(max(dg_resx,dg_resy) == 960 || max(dg_resx, dg_resy) > 1024 ) // wants retina in iPhone4 or iPad3
if(max(dg_resx,dg_resy) == 960 || max(dg_resx, dg_resy) == 2048 ) // wants retina in iPhone4 or iPad3


Or better yet, also add iPhone 5 support
Code (glbasic) Select
if(max(dg_resx,dg_resy) == 960 || max(dg_resx, dg_resy) == 1136 || max(dg_resx, dg_resy) == 2048 )

spacefractal

Not sure that fix the issue because =2048 is same as >1024 and will still scaling when on 960.

the code should first been invoked when the resoulution is set higher than the setting which was set in the project option. so all it's should do is checking the max x resoulution from the project setting and uses that instead of the 1024 fixed value.

With other word, 2x scaling should only invoke on iPad, not iPhone (except if resoulution was set to 320x480 in the option).

Here in my next game, I'm doing all scaling by my self (both way). Example uses strechsprite instead of drawsprite etc. so I'm just workaround here :-).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

maybe I should check for non-retina resolutions?

spacefractal

im believe its should only have checked with iPad Retina, not on iPhone Retina.

Now there is iPhone 5, so the max 1024x768 cant even been using anymore (because Apple reject any iPhone apps that dont support iPhone 5). So im thinks this now confuse more than efter and then its better to remove that check completly again?

Instead as a alternative, when you perform a SETSCREEN 1024x768 on a 2048x1536 display (or SCREENSCREEN 320x480 on 640x960 display), then the surface could change to that user want to been uses and glbasic can auto upscaling.

To checks the screen resolution, just uses GETDESKTOPSIZE (while GETSCREENSIZE uses the currect resolution).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

BdR

I've tried GLBasic v12 and I still get the same results. This is frustrating, because the current version of Snake Slider in the appstore doesn't work correctly on iPads with retina screen. The game area is very small, it is a 640x960 area on a 1536x2048 screen. I recently got an e-mail from a user:
QuoteIt's been almost a year since Snake Slider suddenly became unusable.... it doesn't work on any of our iPads: iPad2, iPad3, iPad mini... and even the new iPad Air because it is simply too tiny in the middle of the screen. Not large enough for adult fingers to manipulate the snakes.
Is there any chance of it being fixed sometime... or should we all just delete Snake Slider from our iPads now? It's been disappointing, as it was a game we played all the time during 2012.
What I'm trying to accomplish is this
In project I set iPhone resolution to 768x1024, and I would want it to work like this:
iPhone4 -> retina 640x960
iPad/iPad2 -> 768x1024 (even when device supports retina 1536x2048)

But what happens is this:
if I set project to 768x1024
iPhone4 -> 320x480 (not ok, resolution is too low)
iPad/iPad2 -> 768x1024 (ok)

if I set project to 640x960
iPhone4 -> retina 640x960 (ok)
iPad2 -> 1536x2048 retina (not ok, resolution is too high)

DaCarSoft


I will try to obtain an iPhone 4 to test that problem...

I would like to see if I can help you.
"Si quieres resultados distintos... no hagas siempre lo mismo" - Albert Einstein.

spacefractal

by the way, your game doseent seen to uses antialasing? try to uses offbuffer when retina is detected. In that way you have much more control what its happens inside your game.

im have never trusted max settings, because there is various iOS devices out now today and iPhone 5 is also required to been supported, or Apple will simply reject your game. That device uses 1136x640 (in Snake Snider, you could show more of the border graphics).

So personally you should fix you game to supports any resoulutions by using 9999x9998, which is only way to do that, and then uses offbuffer when required for scaling.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

DaCarSoft

Yes, Spacefractal is in true...

At this time, GLBasic detects 1024x768 as a non retina resolution, and it changes to "non retina resolutions" mode, turning iPhones in a "compatibility" mode with the old iPhone 3/3Gs/etc. graphics resolutions.

The best way to support retina and non retina devices mixed in an universal app is to change the graphics scale from inside GLBasic's code, setting the project resolution in a value higher than a non retina screen, like 2048 x 1536, for example.

Sorry!!!
"Si quieres resultados distintos... no hagas siempre lo mismo" - Albert Einstein.

spacefractal

That kind of detecting retina or not can't really been used anymore, and me thinks that code should do the same as android does to avoid issues.

Alternative idea is simply choices which resoulution to been supported, and then manually apply a surface. I'm thinking using SETSCREEN for that.

Etc SETSCREEN 1024x768 on a retina screen would simply do a x2 scaling. Here you have more control what it's happings.

On Android, you can set any fixed resoulution, but is impossible doing that by SETSCREEN (thinking ouya in mind).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/