From 2ce7718a665e1b6b3a58195470aa7cebc913826c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 29 Nov 2005 11:39:07 +0000 Subject: [PATCH] From Eric Wing, fixes for "warning: converting of negative value '-0x00000000000000001' to 'unsigned int'" --- examples/osgreflect/osgreflect.cpp | 10 +++++----- src/osg/Stencil.cpp | 4 ++-- src/osgPlugins/geo/ClipRegion.cpp | 8 ++++---- src/osgUtil/RenderBin.cpp | 27 ++++++++++++++++----------- src/osgUtil/SceneView.cpp | 16 ++++++++-------- 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/examples/osgreflect/osgreflect.cpp b/examples/osgreflect/osgreflect.cpp index fa10496e3..bc8a19d9b 100644 --- a/examples/osgreflect/osgreflect.cpp +++ b/examples/osgreflect/osgreflect.cpp @@ -149,7 +149,7 @@ osg::Node* createMirroredScene(osg::Node* model) // set up the stencil ops so that the stencil buffer get set at // the mirror plane osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::ALWAYS,1,~0); + stencil->setFunction(osg::Stencil::ALWAYS,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::REPLACE); // switch off the writing to the color bit planes. @@ -176,7 +176,7 @@ osg::Node* createMirroredScene(osg::Node* model) // occludes the mirror. { osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::ALWAYS,0,~0); + stencil->setFunction(osg::Stencil::ALWAYS,0,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::REPLACE); osg::StateSet* statesetBin2 = new osg::StateSet(); @@ -196,7 +196,7 @@ osg::Node* createMirroredScene(osg::Node* model) // set up the stencil ops so that only operator on this mirrors stencil value. osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::EQUAL,1,~0); + stencil->setFunction(osg::Stencil::EQUAL,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP); // switch off the writing to the color bit planes. @@ -254,7 +254,7 @@ osg::Node* createMirroredScene(osg::Node* model) dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::EQUAL,1,~0); + stencil->setFunction(osg::Stencil::EQUAL,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP); dstate->setAttributeAndModes(stencil,osg::StateAttribute::ON); @@ -281,7 +281,7 @@ osg::Node* createMirroredScene(osg::Node* model) depth->setFunction(osg::Depth::ALWAYS); osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::EQUAL,1,~0); + stencil->setFunction(osg::Stencil::EQUAL,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::ZERO); // set up additive blending. diff --git a/src/osg/Stencil.cpp b/src/osg/Stencil.cpp index a3c29c3ba..62bf2ce2f 100644 --- a/src/osg/Stencil.cpp +++ b/src/osg/Stencil.cpp @@ -19,7 +19,7 @@ Stencil::Stencil() // set up same defaults as glStencilFunc. _func = ALWAYS; _funcRef = 0; - _funcMask = ~0; + _funcMask = ~0u; // set up same defaults as glStencilOp. _sfail = KEEP; @@ -27,7 +27,7 @@ Stencil::Stencil() _zpass = KEEP; // set up same defaults as glStencilMask. - _writeMask = ~0; + _writeMask = ~0u; } diff --git a/src/osgPlugins/geo/ClipRegion.cpp b/src/osgPlugins/geo/ClipRegion.cpp index b164742ac..418f38278 100644 --- a/src/osgPlugins/geo/ClipRegion.cpp +++ b/src/osgPlugins/geo/ClipRegion.cpp @@ -36,7 +36,7 @@ void GeoClipRegion::addClipNode(osg::Node *gd) { // add clip node(s) to set stencil bit marking the clip area. // stencil op so that the stencil buffer get set at the clip pixels osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::ALWAYS,1,~0); + stencil->setFunction(osg::Stencil::ALWAYS,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::REPLACE); state->setAttributeAndModes(stencil,osg::StateAttribute::ON); @@ -74,7 +74,7 @@ bool GeoClipRegion::addClippedChild( osg::Node *child ) osg::StateSet *state=child->getOrCreateStateSet(); // state tests pixels against the set stencil. osg::Stencil* stenciltest = new osg::Stencil; - stenciltest->setFunction(osg::Stencil::EQUAL,1,~0); + stenciltest->setFunction(osg::Stencil::EQUAL,1,~0u); stenciltest->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP); state->setAttributeAndModes(stenciltest,osg::StateAttribute::ON); @@ -97,7 +97,7 @@ bool GeoClipRegion::addObscuredChild( osg::Node *child ) osg::StateSet *state=child->getOrCreateStateSet(); // state tests pixels against the set stencil. osg::Stencil* stenciltest = new osg::Stencil; - stenciltest->setFunction(osg::Stencil::NOTEQUAL,1,~0); + stenciltest->setFunction(osg::Stencil::NOTEQUAL,1,~0u); stenciltest->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP); state->setAttributeAndModes(stenciltest,osg::StateAttribute::ON); @@ -124,7 +124,7 @@ void GeoClipRegion::addDrawClipNode(osg::Node *ndclip) depth->setFunction(osg::Depth::ALWAYS); osg::Stencil* stencil = new osg::Stencil; - stencil->setFunction(osg::Stencil::EQUAL,1,~0); + stencil->setFunction(osg::Stencil::EQUAL,1,~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::ZERO); // set up additive blending. diff --git a/src/osgUtil/RenderBin.cpp b/src/osgUtil/RenderBin.cpp index ada6c6a15..75dcc6ca5 100644 --- a/src/osgUtil/RenderBin.cpp +++ b/src/osgUtil/RenderBin.cpp @@ -400,28 +400,33 @@ void RenderBin::drawImplementation(osg::State& state,RenderLeaf*& previous) // stats bool RenderBin::getStats(Statistics* primStats) -{ // different by return type - collects the stats in this renderrBin - bool somestats=false; +{ + // different by return type - collects the stats in this renderrBin + bool somestats=false; // draw fine grained ordering. for(RenderLeafList::iterator dw_itr = _renderLeafList.begin(); dw_itr != _renderLeafList.end(); ++dw_itr) { - RenderLeaf* rl = *dw_itr; - Drawable* dw= rl->_drawable; - primStats->addDrawable(); // number of geosets - if (rl->_modelview.get()) primStats->addMatrix(); // number of matrices - if (dw) + RenderLeaf* rl = *dw_itr; + Drawable* dw= rl->_drawable; + primStats->addDrawable(); // number of geosets + if (rl->_modelview.get()) { - // then tot up the primtive types and no vertices. - dw->accept(*primStats); // use sub-class to find the stats for each drawable + primStats->addMatrix(); // number of matrices } - somestats = true; + + if (dw) + { + // then tot up the primtive types and no vertices. + dw->accept(*primStats); // use sub-class to find the stats for each drawable + } + somestats = true; } - for(StateGraphList::iterator oitr=_stateGraphList.begin(); + for(StateGraphList::iterator oitr=_stateGraphList.begin(); oitr!=_stateGraphList.end(); ++oitr) { diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index ee858431e..b79e671b0 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -1081,10 +1081,10 @@ void SceneView::draw() glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); - glStencilMask(~0); + glStencilMask(~0u); glClear(GL_STENCIL_BUFFER_BIT); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glStencilFunc(GL_ALWAYS, 1, ~0); + glStencilFunc(GL_ALWAYS, 1, ~0u); glPolygonStipple(patternVertEven); glEnable(GL_POLYGON_STIPPLE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -1103,10 +1103,10 @@ void SceneView::draw() _renderStageRight->setClearMask(_renderStageRight->getClearMask() & ~(GL_STENCIL_BUFFER_BIT|GL_COLOR_BUFFER_BIT)); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilFunc(GL_EQUAL, 0, ~0); + glStencilFunc(GL_EQUAL, 0, ~0u); _renderStageLeft->draw(*_state,previous); - glStencilFunc(GL_NOTEQUAL, 0, ~0); + glStencilFunc(GL_NOTEQUAL, 0, ~0u); _renderStageRight->draw(*_state,previous); glDisable(GL_STENCIL_TEST); } @@ -1146,10 +1146,10 @@ void SceneView::draw() glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); - glStencilMask(~0); + glStencilMask(~0u); glClear(GL_STENCIL_BUFFER_BIT); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glStencilFunc(GL_ALWAYS, 1, ~0); + glStencilFunc(GL_ALWAYS, 1, ~0u); glPolygonStipple(patternHorzEven); glEnable(GL_POLYGON_STIPPLE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -1168,10 +1168,10 @@ void SceneView::draw() _renderStageRight->setClearMask(_renderStageRight->getClearMask() & ~(GL_STENCIL_BUFFER_BIT|GL_COLOR_BUFFER_BIT)); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilFunc(GL_EQUAL, 0, ~0); + glStencilFunc(GL_EQUAL, 0, ~0u); _renderStageLeft->draw(*_state,previous); - glStencilFunc(GL_NOTEQUAL, 0, ~0); + glStencilFunc(GL_NOTEQUAL, 0, ~0u); _renderStageRight->draw(*_state,previous); glDisable(GL_STENCIL_TEST); }