4 #include <QOpenGLContext>
5 #include <QOffscreenSurface>
8 QSurface *create_surface(const QSurfaceFormat &format)
10 QOffscreenSurface *surface = new QOffscreenSurface;
11 surface->setFormat(format);
12 // QWindow *surface = new QWindow;
14 if (!surface->isValid()) {
15 printf("ERROR: surface not valid!\n");
21 QOpenGLContext *create_context()
23 QOpenGLContext *context = new QOpenGLContext;
24 context->setShareContext(QOpenGLContext::globalShareContext());
29 bool make_current(QOpenGLContext *context, QSurface *surface)
31 return context->makeCurrent(surface);