What differences between QOpenGLFramebufferObject::bindDefault() and QOpenGLFramebufferObject::release()?
-
wrote on 10 Jun 2013, 10:44 last edited by
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");
#endifif (current) { current->d_func()->current_fbo = current->defaultFramebufferObject(); d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->d_func()->current_fbo); } return true;
}@
1/1