Retina

So here’s something fun (for me).  At the start of this week, I received one of those fancy retina-display Macbook Pro laptops.

While SDL doesn’t currently support the retina display on the Mac, I’ve hacked things together enough to get MMORPG Tycoon 2 running at standard (i.e. 2x) retina resolution.  And gosh it looks pretty.

Of course, it required a few modifications to the SDL library and to the core VectorStorm library code, and it would be totally broken for non-retina displays (or retina displays set to any scale factor other than a uniform 2x scale).  But I’m pleased to at least see what it would look like.

See, the tricky thing about the retina display is that Apple hasn’t done the usual thing;  just calling it a higher resolution screen.  No, they’ve introduced a completely different display concept;  they’ve introduced the new concept of a “point” (being 1/72th of an inch, I imagine), and have made it possible to vary how many pixels there are inside that “point”.  So this retina laptop screen is still 1400×900 points in size, but is made up of vastly more pixels than that.  And for most GUI tools, this is fantastic;  it lets all existing layouts continue to work and look like they used to (as they’re expressed in ‘points’), and just lets the layering tools of the GUI draw the contents of those points more precisely by using those extra pixels inside the points.

OpenGL, though, isn’t based on points.  It’s based on pixels.  And so most OpenGL-based programs (this includes browsers like Firefox and Chrome) are stuck in the old world, drawing at one-pixel-per-point, and with OSX scaling those one-pixel-per-point images up to fill their window on the screen, like low-resolution textures.

It does make things more tricky, now that Apple’s considering GUI elements to be expressed in points, and OpenGL still being in pixels.  It means that you can no longer (for example) take the window width and pass that into OpenGL as the size you want your viewport to be;  now you have to pass those dimensions through a conversion routine to figure out how many pixels wide your 800-wide window is, and so how big you need to make your offscreen render buffers.

Anyhow, I’m not really sure what I’m going to do with this;  probably just store the build away as an interesting trinket, and wait for the SDL guys to get around to figuring out a proper way to support the retina display.  I’m sure they’ll think of something eventually.  And I’ve really got more important stuff to be playing with, than this.