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:
parent
9b733baf02
commit
75fd039dba
@ -530,6 +530,8 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
|
||||
void setShaderAtomicCounterSupported(bool flag) { _isShaderAtomicCountersSupported = flag; }
|
||||
bool isShaderAtomicCounterSupported() const {return _isShaderAtomicCountersSupported; }
|
||||
|
||||
bool isDrawBuffersSupported() const { return _glDrawBuffers!=0; }
|
||||
|
||||
/** Function to call to get the extension of a specified context.
|
||||
* If the Exentsion object for that context has not yet been created then
|
||||
* and the 'createIfNotInitalized' flag been set to false then returns NULL.
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user