A Qt platform plugin for running Qt/OpenGL applications offscreen

It is supposed to work with Qt versions >= 5.x in UNIXoid environments, where you find an implementation of the Mesa Generic Buffer Management ( gbm ).

This platform allows running OpenGL applications without displaying anything on physical screens. In this respect it is similar to the “offscreen” platform plugin, but without being limited to OpenGL/X11.

The anticipated use cases will postprocess the frames:

My own motivation for this platform plugin is related to the EGLFS/VNC server project ( https://github.com/uwerat/vnc-eglfs ).


For Qt/Quick code might look like this

class FrameHandler : public QObject
        FrameHandler( QQuickWindow* window )
            : m_window( window )
            connect( window, &QQuickWindow::frameSwapped,
                     this, &FrameHandler::grabWindow, Qt::DirectConnection );

        void grabWindow()
                Still on the scene graph thread, ready to postprocess the frame.
                As an example the code below grabs it into an image.

            extern QImage qt_gl_read_framebuffer(
                const QSize&, bool alpha_format, bool include_alpha );

            auto frameBuffer = qt_gl_read_framebuffer( m_window.size(), false, false );

        QQuickWindow* m_window;


View Github