本文整理汇总了C++中QOpenGLContext::defaultFramebufferObject方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLContext::defaultFramebufferObject方法的具体用法?C++ QOpenGLContext::defaultFramebufferObject怎么用?C++ QOpenGLContext::defaultFramebufferObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLContext
的用法示例。
在下文中一共展示了QOpenGLContext::defaultFramebufferObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bindDefault
/*!
\fn bool QOpenGLFramebufferObject::bindDefault()
Switches rendering back to the default, windowing system provided
framebuffer.
Returns \c true upon success, false otherwise.
\sa bind(), release()
*/
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;
}
示例2: release
/*!
\fn bool QOpenGLFramebufferObject::release()
Switches rendering back to the default, windowing system provided
framebuffer.
Returns \c true upon success, false otherwise.
\sa bind()
*/
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;
}