Software Rendered Text Quality in OpenGL Rendered Label Component

Non-OpenGL rendered text seems to look a lot crisper and pleasing to the eyes. I’ve browsed a few older threads regarding text rendering but I was wondering what the current state of OpenGL rendered text is.

Is there a common/elegant solution to obtaining software-rendered text quality using an OpenGLContext render? Below is my OpenGL setup code:

    openGLContext.setRenderer (this);
    openGLContext.setContinuousRepainting (true);
    openGLContext.attachTo (*this);

In my render callback I use the following to do 2D rendering (eg simple meter rectangle shapes):

        const auto desktopScale = openGLContext.getRenderingScale();

        std::unique_ptr<LowLevelGraphicsContext> gcontext (createOpenGLGraphicsContext (
            roundToInt (desktopScale * currEditorWidth),
            roundToInt (desktopScale * currEditorHeight)));

        jassert (gcontext != nullptr);

        Graphics g (*gcontext.get ());
        g.addTransform (AffineTransform::scale ((float) desktopScale));

        shape1->paint (g);
        shape2->paint (g);
        shape3->paint (g);
        // etc...

What I’m interested in, though are some child Label components that update numerical values via a Timer . I would like the numerical text to be of that snazzy crisp software rendered quality :wink:

Of course, any links or tips to info regarding this matter would be greatly appreciated :slight_smile: I’m somewhat new to this domain of lower level graphics.

Running macOS & Windows


When you say “software rendered”, do you really mean “CoreGraphics rendered”? Because the openGL and software engines use exactly the same font rendering code, they’ll be pixel-for-pixel identical!

As for mixing CoreGraphics text into a GL context, no, I don’t know how that could be done without doing some extremely platform-specific changes to the entire GL rendering stack.

Hi Jules, thanks for the reply, I’m a bit shaky with the terminology here. What exactly is the “Software Engine” and how does the differ from the macOS CoreGraphics?

On macOS, If I don’t attach an OpenGLContext , then my labels look like
27 AM
But if I attach the OpenGLContext then it looks like
30 AM

Is there no way to achieve the former (eg in a Label that is the child of an openGL-attached Component)? (Apologies if I’m being redundant here, just trying to reiterate in case I’m not framing my asking correctly :wink: )

1 Like

By default on OSX it’ll use CoreGraphics. The software renderer is a pure-C++ JUCE render engine which you can also choose (but which would be much slower on OSX). The openGL renderer uses the same algorithms as the software one, so draws the text the same way, but looks different because CoreGraphics uses their own font engine which does fancy stuff like fattening up the glyphs.

1 Like

Ah gotcha. Thanks for the help!

What ended up working for us was to use a different TypeFace. I tested some out online and found a .ttf file that did the trick :slight_smile: