X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=context.cpp;h=ea576cd73ff09e6756e0b141bd693d7db8b35239;hb=11e5d7e8d001e32d4f2d634736dda28d643b2bad;hp=4ae85bdd95a7dc09f9abd4676d35fa078e894402;hpb=d147175aaa3e5abfe271940c4518e9ef8dbbc932;p=nageru diff --git a/context.cpp b/context.cpp index 4ae85bd..ea576cd 100644 --- a/context.cpp +++ b/context.cpp @@ -22,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(global_share_widget->context()->contextHandle()); + context->setFormat(surface->format()); context->create(); return context; } @@ -34,3 +35,8 @@ bool make_current(QOpenGLContext *context, QSurface *surface) { return context->makeCurrent(surface); } + +void delete_context(QOpenGLContext *context) +{ + delete context; +}