From 0448b31f93c58e4b8d3c94f1893524369e0f5b96 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 15 Aug 2008 17:25:42 +0000 Subject: [PATCH] From Frashid Larshkari, "I modified the vertical/horizontal interlace stereo modes so that they use the osg::State::applyMode for enabling/disabling certain while rendering the stencil mask. Previously some of these calls were overriding the scene graph states because the global state was not aware of this change. " --- src/osgUtil/SceneView.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 83fa30a42..bc48a6aa7 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -1275,14 +1275,14 @@ void SceneView::draw() glOrtho(getViewport()->x(), getViewport()->width(), getViewport()->y(), getViewport()->height(), -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); + getState()->applyMode(GL_LIGHTING,false); + getState()->applyMode(GL_DEPTH_TEST,false); glStencilMask(~0u); glClear(GL_STENCIL_BUFFER_BIT); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); glStencilFunc(GL_ALWAYS, 1, ~0u); glPolygonStipple(patternVertEven); - glEnable(GL_POLYGON_STIPPLE); + getState()->applyMode(GL_POLYGON_STIPPLE,true); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glRecti(static_cast(getViewport()->x()), @@ -1291,9 +1291,9 @@ void SceneView::draw() static_cast(getViewport()->height()) ); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDisable(GL_POLYGON_STIPPLE); - glEnable(GL_LIGHTING); - glEnable(GL_DEPTH_TEST); + getState()->applyMode(GL_POLYGON_STIPPLE,false); + getState()->applyMode(GL_LIGHTING,true); + getState()->applyMode(GL_DEPTH_TEST,true); _redrawInterlacedStereoStencilMask = false; _interlacedStereoStencilWidth = static_cast(getViewport()->width()); @@ -1352,14 +1352,14 @@ void SceneView::draw() glOrtho(getViewport()->x(), getViewport()->width(), getViewport()->y(), getViewport()->height(), -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); + getState()->applyMode(GL_LIGHTING,false); + getState()->applyMode(GL_DEPTH_TEST,false); glStencilMask(~0u); glClear(GL_STENCIL_BUFFER_BIT); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); glStencilFunc(GL_ALWAYS, 1, ~0u); glPolygonStipple(patternHorzEven); - glEnable(GL_POLYGON_STIPPLE); + getState()->applyMode(GL_POLYGON_STIPPLE,true); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glRecti(static_cast(getViewport()->x()), @@ -1368,9 +1368,9 @@ void SceneView::draw() static_cast(getViewport()->height()) ); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDisable(GL_POLYGON_STIPPLE); - glEnable(GL_LIGHTING); - glEnable(GL_DEPTH_TEST); + getState()->applyMode(GL_POLYGON_STIPPLE,false); + getState()->applyMode(GL_LIGHTING,true); + getState()->applyMode(GL_DEPTH_TEST,true); _redrawInterlacedStereoStencilMask = false; _interlacedStereoStencilWidth = static_cast(getViewport()->width());