Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What differences between QOpenGLFramebufferObject::bindDefault() and QOpenGLFramebufferObject::release()?

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

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 956 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kiichiro
    wrote on 10 Jun 2013, 10:44 last edited by
    #1

    Both methods have same description:

    bq. Switches rendering back to the default, windowing system provided
    framebuffer.
    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.");
    #endif
    }

    return ctx != 0;
    

    }@

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

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

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

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

    }@

    1 Reply Last reply
    0

    1/1

    10 Jun 2013, 10:44

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved