From Farshid Lashkari, "I noticed that osg::State::getInitialViewMatrix returns the monocular view matrix when rendering in stereo. I've made some changes to osgUtil::RenderStage & SceneView so that it will return the correct view matrix depending on which eye is currently being rendered." & "I made a small change to the previous patch so that osg::State::getInitialViewMatrix works correctly with pre/post render stages as well."

This commit is contained in:
Robert Osfield
2010-04-19 14:49:42 +00:00
parent c091b5c2d1
commit b1658ee6df
4 changed files with 12 additions and 3 deletions

View File

@@ -932,6 +932,7 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod
// achieves a certain amount of frame cohereancy of memory allocation.
rendergraph->clean();
renderStage->setInitialViewMatrix(mv.get());
renderStage->setViewport(viewport);
renderStage->setClearColor(_camera->getClearColor());
renderStage->setClearDepth(_camera->getClearDepth());
@@ -1062,8 +1063,6 @@ void SceneView::draw()
// assume the the draw which is about to happen could generate GL objects that need flushing in the next frame.
_requiresFlush = true;
state->setInitialViewMatrix(new osg::RefMatrix(getViewMatrix()));
RenderLeaf* previous = NULL;
if (_displaySettings.valid() && _displaySettings->getStereo())
{