本文整理汇总了C++中FrameBufferObject::hasDepthAttachment方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBufferObject::hasDepthAttachment方法的具体用法?C++ FrameBufferObject::hasDepthAttachment怎么用?C++ FrameBufferObject::hasDepthAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameBufferObject
的用法示例。
在下文中一共展示了FrameBufferObject::hasDepthAttachment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateFrom
bool ImageGL::updateFrom(const ImageGL* source) {
ImageGL* target = this;
// Primarily Copy by FBO blitting, all from source FBO to target FBO
const FrameBufferObject* srcFBO = source->getFBO();
FrameBufferObject* tgtFBO = target->getFBO();
const Texture2D* sTex = source->getColorLayerGL()->getTexture().get();
Texture2D* tTex = target->getColorLayerGL()->getTexture().get();
const std::vector<bool>& srcBuffers = srcFBO->getDrawBuffersInUse();
const std::vector<bool>& targetBuffers = tgtFBO->getDrawBuffersInUse();
srcFBO->setRead_Blit();
tgtFBO->setDraw_Blit();
GLbitfield mask = GL_COLOR_BUFFER_BIT;
if (srcFBO->hasDepthAttachment() && tgtFBO->hasDepthAttachment()) mask |= GL_DEPTH_BUFFER_BIT;
if (srcFBO->hasStencilAttachment() && tgtFBO->hasStencilAttachment())
mask |= GL_STENCIL_BUFFER_BIT;
glBlitFramebufferEXT(0, 0, static_cast<GLint>(sTex->getWidth()),
static_cast<GLint>(sTex->getHeight()), 0, 0,
static_cast<GLint>(tTex->getWidth()),
static_cast<GLint>(tTex->getHeight()), mask, GL_NEAREST);
bool pickingCopied = false;
for (int i = 1; i < srcFBO->getMaxColorAttachments(); i++) {
if (srcBuffers[i] && targetBuffers[i]) {
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + i);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + i);
glBlitFramebufferEXT(
0, 0, static_cast<GLint>(sTex->getWidth()), static_cast<GLint>(sTex->getHeight()),
0, 0, static_cast<GLint>(tTex->getWidth()), static_cast<GLint>(tTex->getHeight()),
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (GL_COLOR_ATTACHMENT0_EXT + i == static_cast<int>(pickingAttachmentID_))
pickingCopied = true;
}
}
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
srcFBO->setRead_Blit(false);
tgtFBO->setDraw_Blit(false);
LGL_ERROR;
// Secondary copy using PBO
// Depth texture
if ((mask & GL_DEPTH_BUFFER_BIT) == 0) {
sTex = source->getDepthLayerGL()->getTexture().get();
tTex = target->getDepthLayerGL()->getTexture().get();
if (sTex && tTex) tTex->loadFromPBO(sTex);
}
LGL_ERROR;
// Picking texture
if (!pickingCopied && pickingAttachmentID_ != 0) {
sTex = source->getPickingLayerGL()->getTexture().get();
tTex = target->getPickingLayerGL()->getTexture().get();
if (sTex && tTex) tTex->loadFromPBO(sTex);
}
LGL_ERROR;
return true;
}