4 #include <QOpenGLContext>
5 #include <QOffscreenSurface>
9 QGLWidget *global_share_widget = nullptr;
11 QSurface *create_surface(const QSurfaceFormat &format)
13 QOffscreenSurface *surface = new QOffscreenSurface;
14 surface->setFormat(format);
15 // QWindow *surface = new QWindow;
17 if (!surface->isValid()) {
18 printf("ERROR: surface not valid!\n");
24 QOpenGLContext *create_context()
26 QOpenGLContext *context = new QOpenGLContext;
27 context->setShareContext(global_share_widget->context()->contextHandle());
32 bool make_current(QOpenGLContext *context, QSurface *surface)
34 return context->makeCurrent(surface);