Exemplo n.º 1
0
void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext() const
{
    if (!m_context->m_attrs.antialias)
        return;

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    const QOpenGLContext* currentContext = QOpenGLContext::currentContext();
    QSurface* currentSurface = 0;
    if (currentContext != m_platformContext) {
        currentSurface = currentContext->surface();
        m_platformContext->makeCurrent(m_surface);
    }
    blitMultisampleFramebuffer();
    if (currentSurface)
        const_cast<QOpenGLContext*>(currentContext)->makeCurrent(currentSurface);
#else
    const QGLContext* currentContext = QGLContext::currentContext();
    const QGLContext* widgetContext = m_surface->context();
    if (currentContext != widgetContext)
        m_surface->makeCurrent();
    blitMultisampleFramebuffer();
    if (currentContext) {
        if (currentContext != widgetContext)
            const_cast<QGLContext*>(currentContext)->makeCurrent();
    } else
        m_surface->doneCurrent();
#endif
}
Exemplo n.º 2
0
void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext()
{
    const QOpenGLContext* currentContext = QOpenGLContext::currentContext();
    QSurface* currentSurface = 0;
    if (currentContext && currentContext != m_platformContext) {
        currentSurface = currentContext->surface();
        m_platformContext->makeCurrent(m_surface);
    }

    if (m_context->m_attrs.antialias)
        blitMultisampleFramebuffer();

    // While the context is still bound, make sure all the Framebuffer content is in finished state.
    // This is necessary as we are doing our own double buffering instead of using a drawable that provides swapBuffers.
    glFinish();

    if (currentContext && currentContext != m_platformContext)
        const_cast<QOpenGLContext*>(currentContext)->makeCurrent(currentSurface);
}