Added clearing of seperation band between horizontal/vertical split stereo

areas.
This commit is contained in:
Robert Osfield
2002-04-16 15:31:46 +00:00
parent 6428715304
commit 5deafbda24
3 changed files with 25 additions and 1 deletions

View File

@@ -250,6 +250,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
const osg::Matrix computeMVPW() const;
void clearArea(int x,int y,int width,int height,const osg::Vec4& color);
osg::ref_ptr<osg::Node> _sceneData;
osg::ref_ptr<osg::StateSet> _globalState;
osg::ref_ptr<osg::Light> _light;

View File

@@ -64,13 +64,15 @@ void RenderStage::draw(osg::State& state,RenderLeaf*& previous)
// set up the back buffer.
//state.applyAttribute(_viewport.get());
_viewport->apply(state);
#define USE_SISSOR_TEST
#ifdef USE_SISSOR_TEST
glScissor( _viewport->x(), _viewport->y(), _viewport->width(), _viewport->height() );
glEnable( GL_SCISSOR_TEST );
#endif
_viewport->apply(state);
// glEnable( GL_DEPTH_TEST );

View File

@@ -452,6 +452,9 @@ void SceneView::draw()
osg::ref_ptr<osg::Viewport> viewportRight = osgNew osg::Viewport;
viewportRight->setViewport(_viewport->x()+right_half_begin,_viewport->y(),right_half_width,_viewport->height());
clearArea(_viewport->x()+left_half_width,_viewport->y(),seperation,_viewport->height(),_renderStageLeft->getClearColor());
if (_displaySettings->getSplitStereoHorizontalEyeMapping()==osg::DisplaySettings::LEFT_EYE_LEFT_VIEWPORT)
{
_renderStageLeft->setViewport(viewportLeft.get());
@@ -486,6 +489,8 @@ void SceneView::draw()
osg::ref_ptr<osg::Viewport> viewportBottom = osgNew osg::Viewport;
viewportBottom->setViewport(_viewport->x(),_viewport->y(),_viewport->width(),bottom_half_height);
clearArea(_viewport->x(),_viewport->y()+bottom_half_height,_viewport->width(),seperation,_renderStageLeft->getClearColor());
if (_displaySettings->getSplitStereoVerticalEyeMapping()==osg::DisplaySettings::LEFT_EYE_TOP_VIEWPORT)
{
_renderStageLeft->setViewport(viewportTop.get());
@@ -608,3 +613,18 @@ const osg::Matrix SceneView::computeMVPW() const
return matrix;
}
void SceneView::clearArea(int x,int y,int width,int height,const osg::Vec4& color)
{
osg::ref_ptr<osg::Viewport> viewport = osgNew osg::Viewport;
viewport->setViewport(x,y,width,height);
viewport->apply(*_state);
glScissor( x, y, width, height );
glEnable( GL_SCISSOR_TEST );
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glClearColor( color[0], color[1], color[2], color[3]);
glClear( GL_COLOR_BUFFER_BIT);
glDisable( GL_SCISSOR_TEST );
}