Page 1 of 4

Retina MacBook Pro.... how will Löve be handled?

Posted: Wed Jun 20, 2012 2:31 am
by Jasoco
So the new MacBook Pro has a Retina model. Retina is a fancy name for HiDPI. Basically the OS will display things at twice its original resolution. Apps that are updated for Retina will have crisp smooth graphics. While older apps will simply have older resolution graphics stretched up to double the size. This of course is a noticeable difference apparently.

*HiDPI Primer: Basically, the OS draws everything doubled up. So instead of the menubar and titlebar being their original 22 pixel heights, they are now 44 pixels. The display has twice the resolution of a 1440x900 display. So the pixels are really small to the point they are almost imperceptible to the naked eye at normal eye distance. (Without putting your nose up to the screen.)

Obviously at some point I think the OS X version of Löve should take advantage of this. But the real question is how to handle it?

In current games, the games have access to the entire pixel resolution when in fullscreen mode. (fullscreen being a whopping 2880x1800 pixels) But of course, these pixels are TINY if you use 1:1 pixel. So games not optimized for Retina yet, like Portal 2, will have teeny tiny text when displaying anything at 1:1. (Which in Portal 2's case is just console text. The actual game and on-screen text is displayed scaled so it displays fine.) While games that are optimized, like Diablo 3, will simply scale everything smoothly but still draw at the entire resolution for a really crisp looking image.

Note: I have not tested a Retina Pro yet nor have I tested Löve on it. I plan on getting one, possibly, maybe, very soon, possibly, but maybe not, but possibly.

Now, the question is, when using love.graphics.getWidth() in FULLSCREEN, (When you set window width and height to zero) does Löve currently:
A) Return the full width of 2880, or..
B) Return the perceived width of 1440?

How does it handle diaplay when in windowed mode? Does it double the pixels up? Will a game with a size set to 640x480 display at 1280x960 and double its pixels up blurry-like?

When using love.graphics.getModes(), what does it return?

This is an interesting new technology and I can't wait to play with it. If possible, I might try and install Löve 0.8.0 on a display model to see how it works. I was wondering if anyone here on the Mac side of development had put any thought into this yet, or if any of them had one of these machines yet.

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Wed Jun 20, 2012 4:01 am
by kexisse
I was wondering about this myself.

I'm thinking more about performance issues, will Löve still have decent frames-per-second with the same number of things on-screen at double the resolution? (with assets that are double resolution too)

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Wed Jun 20, 2012 4:58 am
by Jasoco
Well, they crammed a lot more power into the machine, but I'd love to see some benchmarks too. If I get one of them, I will gladly be a tester. I don't know anything about actually compiling or programming Löve itself, but I can at least test. I can't wait to try it out myself hopefully at the store.

Assets won't matter since it'd only be the titlebar that Löve would need to include since there's really nothing else in the standard Löve app except for the piggy.love file. It's all about how Löve handles displaying the content.

Will it display it at 1:1 pixel, which would basically make anything that's supposed to be say, 640x480, look like it's actually 320x200. Or will it incorporate 2x scaling out of the gate and scale whatever is drawn to twice what you want it to so it still appears to be the same size it should be. Or will Löve let us choose.

I'm hoping for the first, though it would cause problems for most projects since they're not made to show up bigger. Projects you make yourself could be programmed to scale bigger to compensate. But not all developers will know this. So maybe it should be option 3, which is both. I SUGGEST that by default it scales to 2x in hardware. But have an OPTION that can be set in the conf.lua file that can set it to 1:1 pixel ratio. This option would be ignored on computers/displays that don't have HiDPI, but would automatically take effect on HiDPI ones. At the very least I think Löve should double it up, but scale the graphics itself using nearest neighbor mode to prevent the smoothing. If there's one thing I learned from the N64 is that antialiasing was cool back when it was new, but in reality, it's really ugly.

But I don't know. HiDPI is new-ish. But it needs to be dealt with eventually. I'm assuming Löve just displays at doubled size which means pixels will be blurred. (Basically like if you took an image in PhotoShop and doubled its size using linear scaling.) Even though the pixels are crisply drawn, OS X would be doubling them in software via the Windowserver. This is how it handles non-Retina enabled apps. So I'd like to get Löve compatible as soon as possible.

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Wed Jun 20, 2012 7:34 am
by bartbes
That all depends on how osx handles this, so really, we don't know.

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Fri Jun 22, 2012 8:13 am
by bmelts
Tragically, I lack a retina MBP to test anything with, but by all indications, the full pixel dimensions are reported to games, even in windowed mode. That means, of course, that games with set windowed dimensions will look half the size they might be expected to.

I haven't figured out how I want to handle things in LÖVE yet, though. I've been considering pulling an Apple, more or less, and checking for retina-ness and automatically doubling pixel dimensions if so, but that'll really uglify the code having *LOVE_RETINA_MULTIPLIER everywhere. If we do go with automatic doubling, though, I'll probably follow Apple's guidelines and transparently load any @2x images included in the .love, and scale up any images without a doubled counterpart.

Of course, in the upcoming release of OS X Apple has a new OpenGL helper framework that would largely handle this transparently for us, but that can't be relied on for previous versions...

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Fri Jun 22, 2012 9:44 am
by Jasoco
I can't wait to test it out myself. Sadly the store won't be getting them in for a while for reasons I mentioned above. Though I could just driiiiiive all the way to the Lehigh Valley Mall Apple Store, but it's just so far away.

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Fri Jun 22, 2012 10:45 am
by kikito
bmelts wrote:That'll really uglify the code having *LOVE_RETINA_MULTIPLIER everywhere.
Ouch. Let's hope it doesn't have to come to that.

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Sat Jun 23, 2012 3:45 am
by Jasoco
If Löve really does just display pixels on a 1:1 ratio, then I'm glad I'm building in support for changing window scaling and stuff for future projects. Not that it would help current projects.

But if I were the Löve people I'd build in a detection system that by default displays the graphics at 2x with nearest neighbor but include a configuration option to override how Retina is handled. This way by default new Retina owners won't be confused and probably won't even notice a difference since to them it would look exactly like it did on their old display. Don't bother requiring users to include @2x files. There's no reason to. This should be handled seamlessly by Löve itself but allow further handling by the coder creating the game.

Anyone get a chance to check one of these out yet? I really hope I can test Löve when I go in to take a look whenever I am able to. And I hope that's soon.

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Thu Jul 19, 2012 2:34 am
by Jasoco
Thanks to the help of a NeoGAF member I can report that Löve simply displays its graphics at nearest neighbor 2x2 pixels.

1440x900 HiDPI
vwGQ8.png
vwGQ8.png (378.61 KiB) Viewed 3244 times
6Yg0u.png
6Yg0u.png (333.65 KiB) Viewed 3244 times
1680x1050 HiDPI
TsvVe.png
TsvVe.png (403.23 KiB) Viewed 3244 times
Jz5U0.png
Jz5U0.png (330.72 KiB) Viewed 3244 times

Re: Retina MacBook Pro.... how will Löve be handled?

Posted: Thu Jul 19, 2012 3:40 am
by bmelts
Well, that's interesting. How does it handle fullscreen mode?

Working with this to support hi-res images and such should be... "fun".