X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=context.cpp;h=6ce57446b08983c670a3c7b7c99aaf452cc0fe61;hb=b52fb85a67eefa93ad976d3881a9491dfdbd615d;hp=72275e9f9ba5db18d039e8c6e577356a6f9aa2b0;hpb=e18d9bad93d5bf766d52d0cb66db4c3d3f8a711b;p=nageru diff --git a/context.cpp b/context.cpp index 72275e9..6ce5744 100644 --- a/context.cpp +++ b/context.cpp @@ -1,9 +1,13 @@ #include -#include -#include +#include #include -#include +#include +#include + +class QSurface; + +QGLWidget *global_share_widget = nullptr; QSurface *create_surface(const QSurfaceFormat &format) { @@ -18,10 +22,11 @@ QSurface *create_surface(const QSurfaceFormat &format) return surface; } -QOpenGLContext *create_context() +QOpenGLContext *create_context(const QSurface *surface) { QOpenGLContext *context = new QOpenGLContext; - context->setShareContext(QOpenGLContext::globalShareContext()); + context->setShareContext(global_share_widget->context()->contextHandle()); + context->setFormat(surface->format()); context->create(); return context; }