Detect Retina on mac


How can I tell if the app is running on a retina Mac ?
GetGlobalScaleFactor returns 1.0 so that can’t be it.
Thank you


LowLevelGraphicsContext::getPhysicalPixelScaleFactor() is working fine.

The only problem is that you have this info only in Component::paint(Graphics& g) call after getting the context with g.getInternalContext().


In the juce demo there’s a get system info section where you can grab the DPI of the monitors connected to the computer. I’ve used this to check if the DPI is >= normal Retina DPI, which i believe is 144 or something


void MainContentComponent::setDisplayDetails()
const Desktop::Displays::Display& mainDisplay = Desktop::getInstance().getDisplays().getMainDisplay();
displayDetails.scale = (int)mainDisplay.scale;
displayDetails.isRetina = (displayDetails.scale > 1);

DBG("Screen scale is " + String(displayDetails.scale));

if (displayDetails.isRetina)
    DBG("Display is Retina enabled");
    DBG("Display is not Retina");


I’m sure you can work with that somehow`
(have no idea how to apply code style in this markdown-whatever-thing is)


Thank you all three! This should be plenty of info to get things working. :grinning:

For others: the take way here is to scale your “Raw pixels” with:
Desktop::getInstance().getDisplays().getMainDisplay().scale (it’s a float)