From Farshid Lashkari,
"I've attached a small fix to osgUtil::SceneView so that is uses a scissor test when clearing the stencil buffer for stencil based stereo." and "I've added another small change for stencil based stereo, so please use this newer version. This newer version simplifies the calls to glOrtho and glRecti when drawing the stipple pattern. This change also happens to fix an issue where the stencil stereo would not work with certain viewport settings. I'm not exactly sure why this was happening, it might be a graphics driver issue, but either way I think the changes should be fine."
This commit is contained in:
@@ -1329,7 +1329,7 @@ void SceneView::draw()
|
||||
state->applyProjectionMatrix(0);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(getViewport()->x(), getViewport()->width(), getViewport()->y(), getViewport()->height(), -1.0, 1.0);
|
||||
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -1337,7 +1337,10 @@ void SceneView::draw()
|
||||
getState()->applyMode(GL_LIGHTING,false);
|
||||
getState()->applyMode(GL_DEPTH_TEST,false);
|
||||
glStencilMask(~0u);
|
||||
glScissor( getViewport()->x(), getViewport()->y(), getViewport()->width(), getViewport()->height() );
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glDisable( GL_SCISSOR_TEST );
|
||||
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
|
||||
glStencilFunc(GL_ALWAYS, 1, ~0u);
|
||||
if(_displaySettings->getStereoMode() == osg::DisplaySettings::VERTICAL_INTERLACE)
|
||||
@@ -1354,12 +1357,7 @@ void SceneView::draw()
|
||||
}
|
||||
getState()->applyMode(GL_POLYGON_STIPPLE,true);
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
|
||||
glRecti(static_cast<GLint>(getViewport()->x()),
|
||||
static_cast<GLint>(getViewport()->y()),
|
||||
static_cast<GLint>(getViewport()->width()),
|
||||
static_cast<GLint>(getViewport()->height()) );
|
||||
|
||||
glRecti(0, 0, 1, 1);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
getState()->applyMode(GL_POLYGON_STIPPLE,false);
|
||||
getState()->applyMode(GL_LIGHTING,true);
|
||||
|
||||
Reference in New Issue
Block a user