本文整理汇总了C++中QOpenGLContext::shareGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLContext::shareGroup方法的具体用法?C++ QOpenGLContext::shareGroup怎么用?C++ QOpenGLContext::shareGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLContext
的用法示例。
在下文中一共展示了QOpenGLContext::shareGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: takeTexture
/*!
\fn GLuint QOpenGLFramebufferObject::takeTexture()
Returns the texture id for the texture attached to this framebuffer
object. The ownership of the texture is transferred to the caller.
If the framebuffer object is currently bound, an implicit release()
will be done. During the next call to bind() a new texture will be
created.
If a multisample framebuffer object is used, then there is no
texture and the return value from this function will be invalid.
Similarly, incomplete framebuffer objects will also return 0.
\since 5.3
\sa texture(), bind(), release()
*/
GLuint QOpenGLFramebufferObject::takeTexture()
{
Q_D(QOpenGLFramebufferObject);
GLuint id = 0;
if (isValid() && d->texture_guard) {
QOpenGLContext *current = QOpenGLContext::currentContext();
if (current && current->shareGroup() == d->fbo_guard->group() && current->d_func()->current_fbo == d->fbo())
release();
id = d->texture_guard->id();
// Do not call free() on texture_guard, just null it out.
// This way the texture will not be deleted when the guard is destroyed.
d->texture_guard = 0;
}
return id;
}
示例2: setAttachment
/*!
Sets the attachments of the framebuffer object to \a attachment.
This can be used to free or reattach the depth and stencil buffer
attachments as needed.
*/
void QOpenGLFramebufferObject::setAttachment(QOpenGLFramebufferObject::Attachment attachment)
{
Q_D(QOpenGLFramebufferObject);
if (attachment == d->fbo_attachment || !isValid())
return;
QOpenGLContext *current = QOpenGLContext::currentContext();
if (!current)
return;
#ifdef QT_DEBUG
if (current->shareGroup() != d->fbo_guard->group())
qWarning("QOpenGLFramebufferObject::setAttachment() called from incompatible context");
#endif
d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo());
d->initAttachments(current, attachment);
if (current->d_func()->current_fbo != d->fbo())
d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->d_func()->current_fbo);
}
示例3: state
/*!
\fn bool QOpenGLFramebufferObject::bind()
Switches rendering from the default, windowing system provided
framebuffer to this framebuffer object.
Returns \c true upon success, false otherwise.
\note If takeTexture() was called, a new texture is created and associated
with the framebuffer object. This is potentially expensive and changes the
context state (the currently bound texture).
\sa release()
*/
bool QOpenGLFramebufferObject::bind()
{
if (!isValid())
return false;
Q_D(QOpenGLFramebufferObject);
QOpenGLContext *current = QOpenGLContext::currentContext();
if (!current)
return false;
#ifdef QT_DEBUG
if (current->shareGroup() != d->fbo_guard->group())
qWarning("QOpenGLFramebufferObject::bind() called from incompatible context");
#endif
d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo());
if (d->texture_guard || d->format.samples() != 0)
d->valid = d->checkFramebufferStatus(current);
else
d->initTexture(d->format.textureTarget(), d->format.internalTextureFormat(), d->size, d->format.mipmap());
if (d->valid && current)
current->d_func()->current_fbo = d->fbo();
return d->valid;
}
示例4: 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;
}