Added enable of clear stencil and depth mask to ensure that stencil and depth buffers are always cleared when required
This commit is contained in:
parent
eab39329c5
commit
4dd7a87aaa
@ -1209,17 +1209,12 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr
|
||||
// set up the back buffer.
|
||||
state.applyAttribute(_viewport.get());
|
||||
|
||||
#define USE_SCISSOR_TEST
|
||||
#ifdef USE_SCISSOR_TEST
|
||||
glScissor( static_cast<int>(_viewport->x()),
|
||||
static_cast<int>(_viewport->y()),
|
||||
static_cast<int>(_viewport->width()),
|
||||
static_cast<int>(_viewport->height()) );
|
||||
//cout << " clearing "<<this<< " "<<_viewport->x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<<std::endl;
|
||||
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
#endif
|
||||
|
||||
state.applyMode( GL_SCISSOR_TEST, true );
|
||||
|
||||
// glEnable( GL_DEPTH_TEST );
|
||||
|
||||
@ -1228,16 +1223,28 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr
|
||||
else glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
|
||||
if (_clearMask & GL_COLOR_BUFFER_BIT)
|
||||
{
|
||||
glClearColor( _clearColor[0], _clearColor[1], _clearColor[2], _clearColor[3]);
|
||||
}
|
||||
|
||||
if (_clearMask & GL_DEPTH_BUFFER_BIT)
|
||||
{
|
||||
glClearDepth( _clearDepth);
|
||||
glDepthMask ( GL_TRUE );
|
||||
state.haveAppliedAttribute( osg::StateAttribute::DEPTH );
|
||||
}
|
||||
|
||||
if (_clearMask & GL_STENCIL_BUFFER_BIT)
|
||||
{
|
||||
glClearStencil( _clearStencil);
|
||||
glStencilMask ( GL_TRUE );
|
||||
state.haveAppliedAttribute( osg::StateAttribute::STENCIL );
|
||||
}
|
||||
|
||||
if (_clearMask & GL_ACCUM_BUFFER_BIT)
|
||||
{
|
||||
glClearAccum( _clearAccum[0], _clearAccum[1], _clearAccum[2], _clearAccum[3]);
|
||||
}
|
||||
|
||||
|
||||
glClear( _clearMask );
|
||||
|
Loading…
Reference in New Issue
Block a user