[vtk-developers] HiDPI / Retina display support

Marcus D. Hanwell marcus.hanwell at kitware.com
Wed Aug 10 14:19:42 EDT 2016


On Wed, Aug 10, 2016 at 12:32 PM, Sean McBride <sean at rogue-research.com> wrote:
> Hi all,
>
> I'd like to start a bit of discussion/brainstorming on supporting HiDPI (aka "retina" in Apple world) displays.
>
> To do it right I think needs some significant change and forethought.  While I'm familiar with the Mac case, it'd be nice to support this on other OSes properly too.
>
> OpenGL is a pixel-based API, and the Cocoa view/window system no longer is.  They've abstracted a "point" to be defined as either 1x1 or 2x2 or whatever size, depending on the display.  So the OS gives view/window/event sizes/locations in points, and you must scale to get pixels, or vice versa.  Implications for OpenGL are summarized here:
>
> <https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html>
>
> Some thoughts/questions:
>
> - anyone know how other OSes deal with HiDPI displays?

There is a summary of Qt's view of HiDPI here,
http://doc.qt.io/qt-5/highdpi.html
>
> - for OpenGL views on Mac, retina is opt-in (because it uses more memory and can be slower).  I guess we need to expose a new API to opt-in.  I would argue for it being opt-in also.

Sounds reasonable, but Qt applications can already enable this but
QVTKWidget does not render to the full context. I would argue that
letting us test this in Tomviz and other applications would help iron
out kinks (and these code paths only do anything different when you
opt-in).
>
> - which VTK API should be pixel-based, which should be point-based?  Presumably everything is pixel based today, do we want to change any?  If so, some API would need to change from int to double.

I think everything should be pixel-based, and Qt has a similar view for OpenGL.
>
> - tests that compare images... I guess new baselines at various scaling factors are needed?  Or the test system will need to learn to scale images?  or?

I think we would want some 2x images.
>
> - we'll need some dashboards with HiDPI enabled... anyone have hardware, like an iMac, with an actual Retina display that could be used?

Not right now, can it be emulated though? The bigmac machine is on a
standard monitor.
>
> - we'll need to observe for the window moving from a display that supports retina to/from one that doesn't, ex: laptop with external monitor.

We have done that, and it works surprisingly well. You can observe the
doubling in resolution.
>
> (PS: I had been drafting this email for a while, but I understand Mike Jackson is at kitware this week and working on this, so figured I'd send it off not fully baked... :) )
>
Thanks for the input. As this doesn't appear to affect any existing
applications until they turn retinal support on I would think even
phasing in pieces that we get working would be useful. There have been
quite a few posts asking about this on the list. We verified our
changes didn't break any existing dashboards for example.

Marcus


More information about the vtk-developers mailing list