From Wojciech Lewandowski, support for FBO's without colour or depth attachments.

Note from Robert Osfield, I've temporarily re-enabled the old focing of of color and depth attachment to avoid regressions on some OpenGL driver.  We'll revist this once
we have a mechanism for controlling this override at runtime.

#define FORCE_COLOR_ATTACHMENT  1
#define FORCE_DEPTH_ATTACHMENT  1
This commit is contained in:
Robert Osfield
2009-08-21 09:34:48 +00:00
parent 65352c8533
commit 3f65f4f80b
7 changed files with 140 additions and 91 deletions

View File

@@ -53,17 +53,31 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
/** Set the draw buffer used at the start of each frame draw. */
void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; }
void setDrawBuffer(GLenum buffer, bool applyMask = true ) { _drawBuffer = buffer; setDrawBufferApplyMask( applyMask ); }
/** Get the draw buffer used at the start of each frame draw. */
GLenum getDrawBuffer() const { return _drawBuffer; }
/** Get the apply mask defining whether glDrawBuffer is called at each frame draw. */
bool getDrawBufferApplyMask() const { return _drawBufferApplyMask; }
/** Set the apply mask defining whether glDrawBuffer is called at each frame draw. */
void setDrawBufferApplyMask( bool applyMask ) { _drawBufferApplyMask = applyMask; }
/** Set the read buffer for any required copy operations to use. */
void setReadBuffer(GLenum buffer) { _readBuffer = buffer; }
void setReadBuffer(GLenum buffer, bool applyMask = true) { _readBuffer = buffer; setReadBufferApplyMask( applyMask ); }
/** Get the read buffer for any required copy operations to use. */
GLenum getReadBuffer() const { return _readBuffer; }
/** Get the apply mask defining whether glReadBuffer is called at each frame draw. */
bool getReadBufferApplyMask() const { return _readBufferApplyMask; }
/** Set the apply mask defining whether glReadBuffer is called at each frame draw. */
void setReadBufferApplyMask( bool applyMask ) { _readBufferApplyMask = applyMask; }
/** Set the viewport.*/
void setViewport(osg::Viewport* viewport) { _viewport = viewport; }
@@ -251,7 +265,9 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
osg::ref_ptr<osg::Viewport> _viewport;
GLenum _drawBuffer;
bool _drawBufferApplyMask;
GLenum _readBuffer;
bool _readBufferApplyMask;
GLbitfield _clearMask;
osg::ref_ptr<osg::ColorMask> _colorMask;
osg::Vec4 _clearColor;