X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=context.cpp;h=4736b82b8bbebcc0f6327d27acc132809af025f9;hb=e4c99b681aceb0d960f1d56acc9dafc83643854b;hp=4ae85bdd95a7dc09f9abd4676d35fa078e894402;hpb=d147175aaa3e5abfe271940c4518e9ef8dbbc932;p=nageru diff --git a/context.cpp b/context.cpp index 4ae85bd..4736b82 100644 --- a/context.cpp +++ b/context.cpp @@ -22,10 +22,16 @@ QSurface *create_surface(const QSurfaceFormat &format) return surface; } -QOpenGLContext *create_context() +QSurface *create_surface_with_same_format(const QSurface *surface) +{ + return create_surface(surface->format()); +} + +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 +40,8 @@ bool make_current(QOpenGLContext *context, QSurface *surface) { return context->makeCurrent(surface); } + +void delete_context(QOpenGLContext *context) +{ + delete context; +}