What differences between QOpenGLFramebufferObject::bindDefault() and QOpenGLFramebufferObject::release()?

  • Both methods have same description:

    bq. Switches rendering back to the default, windowing system provided
    Returns true upon success, false otherwise.

    Both doing same, but validation is differ. Why need two similar methods?

    @bool QOpenGLFramebufferObject::bindDefault()
    QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
    QOpenGLFunctions functions(ctx);

    if (ctx) {
        ctx->d_func()->current_fbo = ctx->defaultFramebufferObject();
        functions.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo);

    #ifdef QT_DEBUG
    } else {
    qWarning("QOpenGLFramebufferObject::bindDefault() called without current context.");

    return ctx != 0;


    @bool QOpenGLFramebufferObject::release()
    if (!isValid())
    return false;

    QOpenGLContext *current = QOpenGLContext::currentContext();
    if (!current)
        return false;

    #ifdef QT_DEBUG
    if (current->shareGroup() != d->fbo_guard->group())
    qWarning("QOpenGLFramebufferObject::release() called from incompatible context");

    if (current) {
        current->d_func()->current_fbo = current->defaultFramebufferObject();
        d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->d_func()->current_fbo);
    return true;


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.