Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Setting resolution based on iPhone/iPod Retina and Non-Retina display.

Author
Message
Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 29th Aug 2011 04:30 Edited at: 29th Aug 2011 04:35
When i call the GetDeviceWidth() and GetDeviceHeight() commands they give me the same results of 320x480 on both Retina and Non-Retina display in my iPhone Simulator.
When using the Retina display i would have expected a result of 640x960 instead, just like the iPad returns a resolution of 768x1024.

According to the resolution i could then load images of higher quality/resolution, or have a larger play field when the device is an iPad.

Why is the resolution the same for Retina and non-Retina display?

Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 29th Aug 2011 12:59
I'm not sure but maybe the emulator only supports 320x480

Your favorite links anywhere right hereThe Webber Index
Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 29th Aug 2011 16:24
I was able to test it on my iPhone 4 today and it also says the GetDeviceWidth() and GetDeviceHeight() are 320x480.

Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 29th Aug 2011 16:51
I imagine it might have something to do with the API they are using to access it - I'm not familiar with iOS development, but I would imagine that depending on their target version and/or whatever instructions they've given the API it may be returning the lower resolution for the same reason older apps don't get the retina resolution.

There's also the possibility it was hard coded, so we'd have to hear from them to know for sure. I imagine either way it is probably capable of being fixed.
Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 29th Aug 2011 19:23
I've managed to check if it is a retina display using Objective-C code.
If so then i set the resolution with SetVirtualResolution to 640x960, if not then i set it to 320x480.
If GetDeviceWidth() and GetDeviceHeight() return 768x1024 then i know i am on an iPad and i set the resolution to that, and have a larger play field for the iPad version of the game.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 29th Aug 2011 23:47
If you are using Tier 1, look in your Setup.agc file and see if the resolution setting there is 320x480.

If it is, try commenting the 2 lines out that set that, and make sure the first lines in your main code file are the GetDeviceWidth() and GetDeviceHeight() and see what you end up with.

Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 30th Aug 2011 01:24
@KISTech: I am still playing around with stuff and haven't made my mind up just yet if i will continue in Tier 1 or Tier 2. The stuff described above is obviously in Tier 2 using Xcode and C++/Objective-C.
But i will have a look into Tier 1 and see what effect editing Setup.agc will have on the resolution.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Aug 2011 03:16
In my Demo I have manually edited the res in the setup file to match the res I set in game. No idea how the res I picked will display on different devices, but for now I am happy with it. I assume it will give a border on some machines, but I am happy with that, at least on my PC (when I maximize it or run it in full screen mode).
I am hoping AppGameKit will scale it as best it can for any device. I am quite looking forward to seeing a demo running on any phone at the min lol.

As to whether to write in tier 1 or 2. If you are a c++ coder already then use that, it's bound to be faster than tier 1. Obviously it may be faster to prototype an idea in tier 1 even so. I am in the position of really having to use tier 1 as I am unfamiliar with c++, so it's a moot point for me. Still not really having any real issues with it, so it's all good fun.

Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 30th Aug 2011 03:20
It seems the screen resolution you set with SetVirtualResolution is working on any iDevice. So i don't need to check if the device has a retina display.

Setting the resolution to SetVirtualResolution(640, 960) is showing the same result on both my iPhone 4 (Retina) and my iPod Touch (Non-Retina). Both devices run the game in 640x960.
I used GetVirtualWidth() and GetVirtualHeight() to check this.

GetDeviceWidth() and GetDeviceHeight() are still usable to detect the iPad so i can set the resolution to 768x1024, because using 640x960 for an iPad would create black bars on the left and right since the aspect ratio for 768x1024 is 1.33 and for 640x960 it is 1.5

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 30th Aug 2011 18:08
If you are in iOS tier 2 you can call agk::SetResolutionMode( 1 ) to use the maximum resolution of the device, or agk::SetResolutionMode( 0 ) to use a small render target (320x480) and scale it up to device resolution for better performance. Note that this must be called before agk::InitGL() for it to work and therefore cannot be used in tier 1 (hopefully there will be a setup.agc option to set this in future).

This is only used on iOS at the moment.
Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 31st Aug 2011 02:17
agk::SetResolutionMode( 1 ) was already set before agk::InitGL(self.view) in the xcode project template.

Setting the agk::SetResolutionMode to 0 only affected the GetDeviceWidth() and GetDeviceHeight() results on the iPad where they were 384x512 instead of 768x1024.

On both the iPhone(Non-Retina) and iPhone 4(Retina) the results of GetDeviceWidth() and GetDeviceHeight() were 320x480 no matter if i set the agk::SetResolutionMode to 0 or 1.
On both devices I was still able to set the resolution to 640x960 with agk::SetVirtualResolution and run the app in that resolution with agk::SetResolutionMode set to 0.

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Aug 2011 02:56
Looks like the retina display doesn't advertise it's native resolution like the iPad does, it uses a scale parameter instead to say it is twice the advertised resolution, which complicates things.

I'll see if I can detect this properly for a future version.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 31st Aug 2011 10:44
I think it would help to write some kind of identifier function if GetDeviceName() would return something more detailed than just ios.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 31st Aug 2011 10:55
important question: how can I know if agk is actually using the 960x640 graphics on iphone phone, and not scaling down to half res, and then the ios doubling the screen?
Steve O
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: The Netherlands
Posted: 31st Aug 2011 12:28 Edited at: 31st Aug 2011 12:29
I checked it by using a 640x960 background image and then use different resolutions with SetVirtualResolution. If the resolution was 640x960 then the whole background image was visible, with a resolution of 320x480 the background image was only half visible. And on the iPad with the resolution set to 768x1024 there was of course space left on the right side and on the bottom of the background image since the 640x960 background image doesn't fill up the 768x1024 space.

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Aug 2011 15:19
Quote: "I think it would help to write some kind of identifier function if GetDeviceName() would return something more detailed than just ios"


This is already in the next update.

Quote: "how can I know if agk is actually using the 960x640 graphics on iphone phone"


Currently it will never use 960x640, but if it did you could detect it with GetDeviceWidth() and GetDeviceHeight()

Quote: "It seems the screen resolution you set with SetVirtualResolution is working on any iDevice."


The virtual resolution is completely seperate from the device resolution and merely defines what the bounds of the screen are. For example a virtual resolution of 768x1024 would mean that to position something in the center of the screen would be at 384x512, regardless of the current device resolution.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 31st Aug 2011 17:17
Quote: "Currently it will never use 960x640, but if it did you could detect it with GetDeviceWidth() and GetDeviceHeight()"


I thought we could use a res of 960x640 for iPhone retina display and it would be displayed 1:1 not scaled.
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 31st Aug 2011 17:23
I just got another bug or the pictures that i include in xcode project folder, on the left hand side, do not transfer over to my ipod.

I then compiled one of the examples and the pictures did transfer over to my ipod.

I dont know what I did different programming the template, and why the examples work and the template does not work. I guess i try using the examples as a template latter today to see if I can clear up this matter.

Go through yourself at a wall.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Aug 2011 17:41
Quote: "I thought we could use a res of 960x640 for iPhone retina display and it would be displayed 1:1 not scaled."


So did I, but as I said before, the retina display does not advertise its resolution in the way I expected so it will need to be changed in a future version.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 31st Aug 2011 18:16
While we're on the subject of GetDeviceHeight/Width, are they supposed to work on a Windows machine or not? They keep returning whatever values I set in setup.agc, but I want it to scale to the computer's screensize, unless this just isn't possible ofcourse.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 31st Aug 2011 18:21
Quote: "but I want it to scale to the computer's screensize"


There is a fullscreen option in setup.agc that will make the window take up the entire desktop.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 31st Aug 2011 18:24
Oh, that is nice to know! Sorry if that sounded a bit stupid. I have the nasty tendancy to overlook things.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 31st Aug 2011 21:21
Quote: "So did I, but as I said before, the retina display does not advertise its resolution in the way I expected so it will need to be changed in a future version."


Ah too bad. I hope you will manage to find a workaround, as soon, we will have another new iPhone to worry about!

Also does agk::SetResolutionMode(1) have no effect to solve this problem?

Login to post a reply

Server time is: 2024-11-24 03:17:39
Your offset time is: 2024-11-24 03:17:39