Added State::glDrawBuffer/glReadBuffer() method to implement lazy state updating for glDrawBuffer and glReadBuffer
This commit is contained in:
@@ -51,6 +51,9 @@ State::State():
|
||||
_shaderComposer = new ShaderComposer;
|
||||
_currentShaderCompositionProgram = 0L;
|
||||
|
||||
_drawBuffer = GL_NONE;
|
||||
_readBuffer = GL_NONE;
|
||||
|
||||
_identity = new osg::RefMatrix(); // default RefMatrix constructs to identity.
|
||||
_initialViewMatrix = _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)
|
||||
{
|
||||
if (matrix) _initialViewMatrix = matrix;
|
||||
|
||||
Reference in New Issue
Block a user