From Aurelien Albert, "In the "apply" method of osg::FrameBufferObject, the draw buffers are always enabled, even if the target is only "READ_FRAMEBUFFER".
This can lead to inconsistency if you bind a framebuffer with multiple attachments in DRAW mode and then a framebuffer with different attachment count in READ mode (for example to manually "blit" from a FBo to another). On some ATI cards (at least RADEON HD) this also leads to an "incomplete " FBO status I've added a test to enable drawbuffers only if target is "DRAW" or "READ_DRAW", this solves my problems on ATI cards."
This commit is contained in:
@@ -914,16 +914,19 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
|
||||
ext->glBindFramebuffer(target, fboID);
|
||||
|
||||
// enable drawing buffers to render the result to fbo
|
||||
if (_drawBuffers.size() > 0)
|
||||
if ( (target == READ_DRAW_FRAMEBUFFER) || (target == DRAW_FRAMEBUFFER) )
|
||||
{
|
||||
GL2Extensions *gl2e = GL2Extensions::Get(state.getContextID(), true );
|
||||
if (gl2e && gl2e->isDrawBuffersSupported())
|
||||
if (_drawBuffers.size() > 0)
|
||||
{
|
||||
gl2e->glDrawBuffers(_drawBuffers.size(), &(_drawBuffers[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN <<"Warning: FrameBufferObject: could not set draw buffers, glDrawBuffers is not supported!" << std::endl;
|
||||
GL2Extensions *gl2e = GL2Extensions::Get(state.getContextID(), true );
|
||||
if (gl2e && gl2e->isDrawBuffersSupported())
|
||||
{
|
||||
gl2e->glDrawBuffers(_drawBuffers.size(), &(_drawBuffers[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN <<"Warning: FrameBufferObject: could not set draw buffers, glDrawBuffers is not supported!" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user