Added State::glDrawBuffer/glReadBuffer() method to implement lazy state updating for glDrawBuffer and glReadBuffer
This commit is contained in:
parent
ee3235e7e0
commit
64341cfb72
@ -303,6 +303,14 @@ class OSG_EXPORT State : public Referenced
|
|||||||
/** Apply any shader composed state.*/
|
/** Apply any shader composed state.*/
|
||||||
void applyShaderComposition();
|
void applyShaderComposition();
|
||||||
|
|
||||||
|
|
||||||
|
void glDrawBuffer(GLenum buffer);
|
||||||
|
GLenum getDrawBuffer() const { return _drawBuffer; }
|
||||||
|
|
||||||
|
void glReadBuffer(GLenum buffer);
|
||||||
|
GLenum getReadBuffer() const { return _readBuffer; }
|
||||||
|
|
||||||
|
|
||||||
/** Set whether a particular OpenGL mode is valid in the current graphics context.
|
/** Set whether a particular OpenGL mode is valid in the current graphics context.
|
||||||
* Use to disable OpenGL modes that are not supported by current graphics drivers/context.*/
|
* Use to disable OpenGL modes that are not supported by current graphics drivers/context.*/
|
||||||
inline void setModeValidity(StateAttribute::GLMode mode,bool valid)
|
inline void setModeValidity(StateAttribute::GLMode mode,bool valid)
|
||||||
@ -1079,6 +1087,9 @@ class OSG_EXPORT State : public Referenced
|
|||||||
|
|
||||||
ref_ptr<FrameStamp> _frameStamp;
|
ref_ptr<FrameStamp> _frameStamp;
|
||||||
|
|
||||||
|
GLenum _drawBuffer;
|
||||||
|
GLenum _readBuffer;
|
||||||
|
|
||||||
ref_ptr<const RefMatrix> _identity;
|
ref_ptr<const RefMatrix> _identity;
|
||||||
ref_ptr<const RefMatrix> _initialViewMatrix;
|
ref_ptr<const RefMatrix> _initialViewMatrix;
|
||||||
ref_ptr<const RefMatrix> _projection;
|
ref_ptr<const RefMatrix> _projection;
|
||||||
|
@ -51,6 +51,9 @@ State::State():
|
|||||||
_shaderComposer = new ShaderComposer;
|
_shaderComposer = new ShaderComposer;
|
||||||
_currentShaderCompositionProgram = 0L;
|
_currentShaderCompositionProgram = 0L;
|
||||||
|
|
||||||
|
_drawBuffer = GL_NONE;
|
||||||
|
_readBuffer = GL_NONE;
|
||||||
|
|
||||||
_identity = new osg::RefMatrix(); // default RefMatrix constructs to identity.
|
_identity = new osg::RefMatrix(); // default RefMatrix constructs to identity.
|
||||||
_initialViewMatrix = _identity;
|
_initialViewMatrix = _identity;
|
||||||
_projection = _identity;
|
_projection = _identity;
|
||||||
@ -434,6 +437,28 @@ void State::reset()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void State::glDrawBuffer(GLenum buffer)
|
||||||
|
{
|
||||||
|
if (_drawBuffer!=buffer)
|
||||||
|
{
|
||||||
|
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||||
|
glDrawBuffer(buffer);
|
||||||
|
#endif
|
||||||
|
_drawBuffer=buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void State::glReadBuffer(GLenum buffer)
|
||||||
|
{
|
||||||
|
if (_readBuffer!=buffer)
|
||||||
|
{
|
||||||
|
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GLES3_AVAILABLE)
|
||||||
|
glReadBuffer(buffer);
|
||||||
|
#endif
|
||||||
|
_readBuffer=buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void State::setInitialViewMatrix(const osg::RefMatrix* matrix)
|
void State::setInitialViewMatrix(const osg::RefMatrix* matrix)
|
||||||
{
|
{
|
||||||
if (matrix) _initialViewMatrix = matrix;
|
if (matrix) _initialViewMatrix = matrix;
|
||||||
|
Loading…
Reference in New Issue
Block a user