void GLPlatformContext::releaseCurrent()
{
    if (this == m_currentContext) {
        m_currentContext = 0;
        platformReleaseCurrent();
    }
}
Esempio n. 2
0
void GLPlatformContext::releaseCurrent()
{
    if (!isCurrentContext())
        return;

    m_currentContext = 0;
    platformReleaseCurrent();
}
bool GLPlatformContext::makeCurrent(GLPlatformSurface* surface)
{
    m_contextLost = false;

    if (m_currentContext == this && (!surface || surface->isCurrentDrawable()))
        return true;

    m_currentContext = 0;

    if (!surface || (surface && !surface->drawable()))
        platformReleaseCurrent();
    else if (platformMakeCurrent(surface)) {
        m_currentContext = this;
        surface->onMakeCurrent();
    }

    if (m_resetLostContext) {
        resolveResetStatusExtension();

        if (glGetGraphicsResetStatus) {
            GLenum status = glGetGraphicsResetStatus();

            switch (status) {
            case PLATFORMCONTEXT_NO_ERROR:
                break;
            case PLATFORMCONTEXT_GUILTY_CONTEXT_RESET:
                m_contextLost = true;
                break;
            case PLATFORMCONTEXT_INNOCENT_CONTEXT_RESET:
                break;
            case PLATFORMCONTEXT_UNKNOWN_CONTEXT_RESET:
                m_contextLost = true;
                break;
            default:
                break;
            }
        }
    }

    return m_currentContext;
}