]> git.sesse.net Git - nageru/blobdiff - context.cpp
Use QGLWidget instead of QOpenGLWidget, as the latter is too slow.
[nageru] / context.cpp
index 72275e9f9ba5db18d039e8c6e577356a6f9aa2b0..946d40dc84ab1b0c5462311f6e4bdf1af3355f10 100644 (file)
@@ -4,6 +4,9 @@
 #include <QOpenGLContext>
 #include <QOffscreenSurface>
 #include <QWindow>
+#include <QGLWidget>
+
+QGLWidget *global_share_widget = nullptr;
 
 QSurface *create_surface(const QSurfaceFormat &format)
 {
@@ -21,7 +24,7 @@ QSurface *create_surface(const QSurfaceFormat &format)
 QOpenGLContext *create_context()
 {
        QOpenGLContext *context = new QOpenGLContext;
-       context->setShareContext(QOpenGLContext::globalShareContext());
+       context->setShareContext(global_share_widget->context()->contextHandle());
        context->create();
        return context;
 }