From 5b70f208e3c7d6b69dbbcc4337d48d012e2ec14d Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 1 Aug 2016 17:47:32 +0200 Subject: [PATCH] Fix RenderBuffer not being attached (bug introduced with commit 55b3becb7c0ceecf26b0dae2c6db80f9f2a8a6d4 ) --- src/osg/FrameBufferObject.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/osg/FrameBufferObject.cpp b/src/osg/FrameBufferObject.cpp index 1c37761cf..cb79979ba 100644 --- a/src/osg/FrameBufferObject.cpp +++ b/src/osg/FrameBufferObject.cpp @@ -449,6 +449,13 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen { unsigned int contextID = state.getContextID(); + if (_ximpl->targetType == Pimpl::RENDERBUFFER) + { + ext->glFramebufferRenderbuffer(target, attachment_point, GL_RENDERBUFFER_EXT, _ximpl->renderbufferTarget->getObjectID(contextID, ext)); + return; + } + + // targetType must be a texture, make sure we have a valid texture object Texture::TextureObject *tobj = 0; if (_ximpl->textureTarget.valid()) { @@ -465,10 +472,8 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen switch (_ximpl->targetType) { - default: case Pimpl::RENDERBUFFER: - ext->glFramebufferRenderbuffer(target, attachment_point, GL_RENDERBUFFER_EXT, _ximpl->renderbufferTarget->getObjectID(contextID, ext)); - break; + break; // already handled above. case should never be hit, just here to quieten compiler warning. case Pimpl::TEXTURE1D: ext->glFramebufferTexture1D(target, attachment_point, GL_TEXTURE_1D, tobj->id(), _ximpl->level); break;