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

@@ -294,14 +294,14 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
/** Set the draw buffer used at the start of each frame draw.
* Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/
void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; }
void setDrawBuffer(GLenum buffer) { _drawBuffer = buffer; applyMaskAction( DRAW_BUFFER ); }
/** Get the draw buffer used at the start of each frame draw. */
GLenum getDrawBuffer() const { return _drawBuffer; }
/** Set the read buffer for any required copy operations to use.
* Note, a buffer value of GL_NONE is used to sepecify that the rendering back-end should choose the most appropriate buffer.*/
void setReadBuffer(GLenum buffer) { _readBuffer = buffer; }
void setReadBuffer(GLenum buffer) { _readBuffer = buffer; applyMaskAction( READ_BUFFER ); }
/** Get the read buffer for any required copy operations to use. */
GLenum getReadBuffer() const { return _readBuffer; }

View File

@@ -58,25 +58,27 @@ class OSG_EXPORT CullSettings
enum VariablesMask
{
COMPUTE_NEAR_FAR_MODE = 0x0001,
CULLING_MODE = 0x0002,
LOD_SCALE = 0x0004,
SMALL_FEATURE_CULLING_PIXEL_SIZE = 0x0008,
CLAMP_PROJECTION_MATRIX_CALLBACK = 0x0010,
NEAR_FAR_RATIO = 0x0020,
IMPOSTOR_ACTIVE = 0x0040,
DEPTH_SORT_IMPOSTOR_SPRITES = 0x0080,
IMPOSTOR_PIXEL_ERROR_THRESHOLD = 0x0100,
NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES = 0x0200,
CULL_MASK = 0x0400,
CULL_MASK_LEFT = 0x0800,
CULL_MASK_RIGHT = 0x1000,
CLEAR_COLOR = 0x2000,
LIGHTING_MODE = 0x4000,
LIGHT = 0x8000,
NO_VARIABLES = 0x0000,
ALL_VARIABLES = 0xFFFF
COMPUTE_NEAR_FAR_MODE = 0x00000001,
CULLING_MODE = 0x00000002,
LOD_SCALE = 0x00000004,
SMALL_FEATURE_CULLING_PIXEL_SIZE = 0x00000008,
CLAMP_PROJECTION_MATRIX_CALLBACK = 0x00000010,
NEAR_FAR_RATIO = 0x00000020,
IMPOSTOR_ACTIVE = 0x00000040,
DEPTH_SORT_IMPOSTOR_SPRITES = 0x00000080,
IMPOSTOR_PIXEL_ERROR_THRESHOLD = 0x00000100,
NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES = 0x00000200,
CULL_MASK = 0x00000400,
CULL_MASK_LEFT = 0x00000800,
CULL_MASK_RIGHT = 0x00001000,
CLEAR_COLOR = 0x00002000,
LIGHTING_MODE = 0x00004000,
LIGHT = 0x00008000,
DRAW_BUFFER = 0x00010000,
READ_BUFFER = 0x00020000,
NO_VARIABLES = 0x00000000,
ALL_VARIABLES = 0xFFFFFFFF
};
/** Set the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/

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;