Nominate our 2022 Qt Champions!

QOpenGLWidget creates 6kx3k fbos on macOS with 4k display

  • Hi,

    I'm working on an OpenGL game and i've encountered a performance issue when using a mac, with a 4k display.

    When I'm running my game (with the window maximised) on a 4k display in non scaled mode I have a viewport resolution of resolution of 3840 * 2160 and Qt internally renders at this resolution. This is a 1:1 to resolution of my monitor and my game renders fine. But when I run the game at a lower resolution 3360 * 1890 high DPI scaling kicks in. This causes an internal resolution of 6720 * 3780 and this is killing performance. I've been poking around in the code of QOpenGlWidget and had some some success getting some performance back by removing this scale when QOpenGlWidget renders to its fbos - but the underlying surface still has a the *2 scale applied.

    I understand why you would want to render at a high dpi for text, buttons etc, but for an opengl viewport in a game - it's totally overkill.

    Is there a way to disable scaling on a QOpenGlWidget so that it internally always renders as the native resolution.


  • Lifetime Qt Champion


    Please do not post the same question in multiple sub forum. One is enough


    Closing this one

Log in to reply