Merge pull request #109 from scrawl/renderbuffer_fix

Fix RenderBuffer not being attached
This commit is contained in:
OpenSceneGraph git repository 2016-08-02 15:27:39 +01:00 committed by GitHub
commit 46fb6bd299

View File

@ -449,6 +449,13 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen
{ {
unsigned int contextID = state.getContextID(); 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; Texture::TextureObject *tobj = 0;
if (_ximpl->textureTarget.valid()) if (_ximpl->textureTarget.valid())
{ {
@ -465,10 +472,8 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen
switch (_ximpl->targetType) switch (_ximpl->targetType)
{ {
default:
case Pimpl::RENDERBUFFER: case Pimpl::RENDERBUFFER:
ext->glFramebufferRenderbuffer(target, attachment_point, GL_RENDERBUFFER_EXT, _ximpl->renderbufferTarget->getObjectID(contextID, ext)); break; // already handled above. case should never be hit, just here to quieten compiler warning.
break;
case Pimpl::TEXTURE1D: case Pimpl::TEXTURE1D:
ext->glFramebufferTexture1D(target, attachment_point, GL_TEXTURE_1D, tobj->id(), _ximpl->level); ext->glFramebufferTexture1D(target, attachment_point, GL_TEXTURE_1D, tobj->id(), _ximpl->level);
break; break;