The Retinal displays on the 4th generation iOS device series requires high resolution graphics for the best quality.
Apple supports placing two images with the same base filename in the Xcode project, one high-res, one low-res. For example:
myGraphic.png
[email protected]
And the correct file is automatically loaded by the iOS device on program launch.
Is Orx compatible with this? In other words, is it enough to have one Orx config file and just supply two images in the Xcode project as described above?
Thanks!
Comments
So far I'm uding high def images for both retina and non-retina displays. The scaling down didn't show any visible artifacts in my cases but I guess that depends on what's in your bitmap.
I'm using this tutorial to work in landscape mode: http://orx-project.org/wiki/en/orx/tutorials/community/tdomhan/ipadport
I positioned our bitmaps and scaled text graphics so that everything looks correct on my iPod Touch 4 and on my partner's iPhone 4.
But on my other partner's iPhone 3GS everything is 2x too large..this is also how it looks on iPhone Simulator unless I change Hardware to "Retina" mode. Then everything is correct.
As for scaling down, orx works in a resolution independent way, which is a great strength when one want to support multiple resolutions or even different aspect ratios (especially for UI items or any camera relative positioning).
Can you tell me what you have for your viewport/camera settings?
Let's say your primary targeted resolution is 640x960 (to match the iPhone retina in portrait mode).
First you need to define all your assets with that size in mind and then set your camera frustum to have a width of 640 and a height of 960.
That means that the camera will "see" 640x960 pixels of your world, wherever it's placed. So an object of size 640x480 will exactly occupy half of the camera's "view" (horizontally).
Now your camera is linked to a viewport, which size by default matches the display size (always fullscreen on iOS).
So on a retina iPhone, the display size will be 640x960 which means there won't be any up or down scaling as that matches exactly the camera's frustum.
On a non-retina iPhone, the display size will be 320x480, which means orx will downscale everything to fit the 640x960 seen by the camera into the 320x480 pixels of the viewports. Actually it'll scale all the rendering by 0.5 on both axes.
If you want a landscape rendering, you simply need to rotate your game by 90°.
Be careful to harcode the camera frustum with fixed values. If you do something like:
The camera will not see the same amount of world space depending on the screen size, ie. on retina display it'll see much more world space than on a non-retina display.
Let me know if this helps.
I was having my Camera inherit its dimensions from the display, like so:
The problem is Display.ScreenWidth and Display.ScreenHeight are different between the two devices (480x320 or 960x640), so you end up with two different Camera dimensions.
If I make sure the .ScreenWidth and .ScreenHeight values stay consistent between devices, there is no positioning problem.
Awesome!
Thanks again.
A wiki section about that would be great but I don't know when I'll be able to write one. Don't hesitate to do it yourself if you feel like it though.
Also, I'm glad that fixed your issue. I'll still add support for the @2x, but downscaling should give acceptable visual results till then.
Another option would be to try manually adding the different extensions and loading the correct image, but I'm not satisfied with it either. I'm not even sure everything would work smoothly as OpenGL doesn't care of the scale property of the images and I'd have to rescale everything manually at some point. For now I suggest simply using hi-rez all the time and if this brings artifacts on low-rez devices, we'll define a battle plan.
If there's any trouble, I don't think it would be a big problem to load different images for the low res device at run-time for the short term.
iOS exact device detection code
Does device have Retina display