Added GL2Extensions::isDrawBuffersSupported() and usage of this in FrameBufferObject.cpp to prevent crash under GLES2 when users attempt to use MRT when it's not supported

This commit is contained in:
Robert Osfield
2013-07-24 13:02:32 +00:00
parent 9b733baf02
commit 75fd039dba
2 changed files with 8 additions and 2 deletions

View File

@@ -916,10 +916,14 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
if (_drawBuffers.size() > 0)
{
GL2Extensions *gl2e = GL2Extensions::Get(state.getContextID(), true );
if (gl2e)
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;
}
}
if (dirtyAttachmentList)
@@ -939,7 +943,7 @@ void FrameBufferObject::apply(State &state, BindTarget target) const
{
OSG_WARN <<
"Warning: FrameBufferObject: could not attach PACKED_DEPTH_STENCIL_BUFFER, "
"EXT_packed_depth_stencil is not supported !" << std::endl;
"EXT_packed_depth_stencil is not supported!" << std::endl;
}
break;