diff --git a/include/osg/GL2Extensions b/include/osg/GL2Extensions index 39d2c3545..0c4a1a699 100644 --- a/include/osg/GL2Extensions +++ b/include/osg/GL2Extensions @@ -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. diff --git a/src/osg/FrameBufferObject.cpp b/src/osg/FrameBufferObject.cpp index 68c755a8c..ec570d14e 100644 --- a/src/osg/FrameBufferObject.cpp +++ b/src/osg/FrameBufferObject.cpp @@ -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;