From 4895b22da1b723f0fdca00590131da21d5750c14 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 13 Jul 2002 21:17:40 +0000 Subject: [PATCH] Fixed various warnings which were appearing under MacOSX. --- src/Demos/osgclip/osgclip.cpp | 2 +- src/Demos/osgtext/main.cpp | 59 +++++++++++++++------------- src/osg/Geometry.cpp | 28 ++++--------- src/osg/ShadowVolumeOccluder.cpp | 5 +-- src/osgDB/Output.cpp | 2 +- src/osgPlugins/flt/GeoSetBuilder.cpp | 3 ++ src/osgUtil/Tesselator.cpp | 2 + 7 files changed, 47 insertions(+), 54 deletions(-) diff --git a/src/Demos/osgclip/osgclip.cpp b/src/Demos/osgclip/osgclip.cpp index ad29b46d7..d31bf0e06 100644 --- a/src/Demos/osgclip/osgclip.cpp +++ b/src/Demos/osgclip/osgclip.cpp @@ -62,7 +62,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph) // create wireframe view of the model so the user can see // what parts are being culled away. osg::StateSet* stateset = new osg::StateSet; - osg::Material* material = new osg::Material; + //osg::Material* material = new osg::Material; osg::PolygonMode* polymode = new osg::PolygonMode; polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE); stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE_ON); diff --git a/src/Demos/osgtext/main.cpp b/src/Demos/osgtext/main.cpp index 3fe5589fb..5c07d6581 100644 --- a/src/Demos/osgtext/main.cpp +++ b/src/Demos/osgtext/main.cpp @@ -57,7 +57,6 @@ void set2dScene(osg::Group* rootNode) { osgText::Text* text; osg::Geode* geode; - osg::Material* textMaterial; osg::StateSet* textState; double xOffset=150; double yOffset=gFontSize+10; @@ -213,7 +212,6 @@ void setScene(osg::Group* rootNode) { osgText::Text* text; osg::Geode* geode; - osg::Material* textMaterial; osg::StateSet* textState; double xOffset=0; double yOffset=0; @@ -232,16 +230,17 @@ void setScene(osg::Group* rootNode) osgText::Text::BOUNDINGBOX | osgText::Text::ALIGNMENT ); text->setAlignment(gAlignment); + text->setColor(TEXT_COL_3D); geode = osgNew osg::Geode(); geode->setName("BitmapFont"); geode->addDrawable( text ); - textMaterial = osgNew osg::Material(); - textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); - textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); - textState = osgNew osg::StateSet(); - textState->setAttribute(textMaterial ); - geode->setStateSet( textState ); +// textMaterial = osgNew osg::Material(); +// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); +// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); +// textState = osgNew osg::StateSet(); +// textState->setAttribute(textMaterial ); +// geode->setStateSet( textState ); rootNode->addChild(geode); @@ -259,19 +258,20 @@ void setScene(osg::Group* rootNode) osgText::Text::BOUNDINGBOX | osgText::Text::ALIGNMENT ); text->setAlignment(gAlignment); + text->setColor(TEXT_COL_3D); geode = osgNew osg::Geode(); geode->setName("PixmapFont"); geode->addDrawable( text ); - textMaterial = osgNew osg::Material(); - textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); - textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); +// textMaterial = osgNew osg::Material(); +// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); +// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); // to get antiaA pixmapFonts we have to draw them with blending osg::BlendFunc *transp= osgNew osg::BlendFunc(); transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); textState = osgNew osg::StateSet(); - textState->setAttribute(textMaterial ); +// textState->setAttribute(textMaterial ); textState->setAttribute(transp); textState->setMode(GL_BLEND,osg::StateAttribute::ON); textState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); @@ -293,19 +293,20 @@ void setScene(osg::Group* rootNode) osgText::Text::BOUNDINGBOX | osgText::Text::ALIGNMENT ); text->setAlignment(gAlignment); + text->setColor(TEXT_COL_3D); geode = osgNew osg::Geode(); geode->setName("TextureFont"); geode->addDrawable( text ); - textMaterial = osgNew osg::Material(); - textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); - textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); +// textMaterial = osgNew osg::Material(); +// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); +// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); // to get antiaA pixmapFonts we have to draw them with blending transp= osgNew osg::BlendFunc(); transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); textState = osgNew osg::StateSet(); - textState->setAttribute(textMaterial ); +// textState->setAttribute(textMaterial ); textState->setAttribute(transp); // textState->setMode(GL_BLEND,osg::StateAttribute::ON); @@ -330,16 +331,17 @@ void setScene(osg::Group* rootNode) osgText::Text::BOUNDINGBOX | osgText::Text::ALIGNMENT ); text->setAlignment(gAlignment); + text->setColor(TEXT_COL_3D); geode = osgNew osg::Geode(); geode->setName("PolygonFont"); geode->addDrawable( text ); - textMaterial = osgNew osg::Material(); - textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); - textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); - textState = osgNew osg::StateSet(); - textState->setAttribute(textMaterial ); - geode->setStateSet( textState ); +// textMaterial = osgNew osg::Material(); +// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); +// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); +// textState = osgNew osg::StateSet(); +// textState->setAttribute(textMaterial ); +// geode->setStateSet( textState ); rootNode->addChild(geode); @@ -359,16 +361,17 @@ void setScene(osg::Group* rootNode) osgText::Text::BOUNDINGBOX | osgText::Text::ALIGNMENT ); text->setAlignment(gAlignment); + text->setColor(TEXT_COL_3D); geode = osgNew osg::Geode(); geode->setName("OutlineFont"); geode->addDrawable( text ); - textMaterial = osgNew osg::Material(); - textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); - textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); - textState = osgNew osg::StateSet(); - textState->setAttribute(textMaterial ); - geode->setStateSet( textState ); +// textMaterial = osgNew osg::Material(); +// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE); +// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D); +// textState = osgNew osg::StateSet(); +// textState->setAttribute(textMaterial ); +// geode->setStateSet( textState ); rootNode->addChild(geode); diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 174ecc302..a368b8f69 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -45,9 +45,6 @@ void Geometry::drawImmediateMode(State& state) if (!_vertexArray.valid()) return; // set up the vertex arrays. -// glEnableClientState( GL_VERTEX_ARRAY ); -// glVertexPointer(3,GL_FLOAT,0,_vertexArray->dataPointer()); - state.setVertexPointer(3,GL_FLOAT,0,_vertexArray->dataPointer()); // set up texture coordinates. @@ -55,16 +52,9 @@ void Geometry::drawImmediateMode(State& state) { Array* array = _texCoordList[i].get(); if (array) - { -// glEnableClientState( GL_TEXTURE_COORD_ARRAY ); -// glTexCoordPointer(array->dataSize(),array->dataType(),0,array->dataPointer()); state.setTexCoordPointer(i,array->dataSize(),array->dataType(),0,array->dataPointer()); - } else - { -// glDisableClientState( GL_TEXTURE_COORD_ARRAY ); state.disableTexCoordPointer(i); - } } @@ -75,22 +65,18 @@ void Geometry::drawImmediateMode(State& state) switch (_normalBinding) { case(BIND_OFF): -// glDisableClientState( GL_NORMAL_ARRAY ); state.disableNormalPointer(); break; case(BIND_OVERALL): -// glDisableClientState( GL_NORMAL_ARRAY ); state.disableNormalPointer(); if (normalPointer) glNormal3fv(reinterpret_cast(normalPointer)); break; case(BIND_PER_PRIMITIVE): -// glDisableClientState( GL_NORMAL_ARRAY ); state.disableNormalPointer(); break; case(BIND_PER_VERTEX): -// glEnableClientState( GL_NORMAL_ARRAY ); -// if (normalPointer) glNormalPointer(GL_FLOAT,0,normalPointer); if (normalPointer) state.setNormalPointer(GL_FLOAT,0,normalPointer); + else state.disableNormalPointer(); break; } @@ -124,17 +110,17 @@ void Geometry::drawImmediateMode(State& state) colorStride = 16; break; } + default: + break; } } switch (_colorBinding) { case(BIND_OFF): -// glDisableClientState( GL_COLOR_ARRAY ); state.disableColorPointer(); break; case(BIND_OVERALL): -// glDisableClientState( GL_COLOR_ARRAY ); state.disableColorPointer(); if (colorPointer) { @@ -149,17 +135,17 @@ void Geometry::drawImmediateMode(State& state) case(Array::Vec4ArrayType): glColor4fv(reinterpret_cast(colorPointer)); break; + default: + break; } } break; case(BIND_PER_PRIMITIVE): -// glDisableClientState( GL_COLOR_ARRAY ); state.disableColorPointer(); break; case(BIND_PER_VERTEX): -// glEnableClientState( GL_COLOR_ARRAY ); -// if (colorPointer) glColorPointer(_colorArray->dataSize(),_colorArray->dataType(),0,colorPointer); if (colorPointer) state.setColorPointer(_colorArray->dataSize(),_colorArray->dataType(),0,colorPointer); + else state.disableColorPointer(); } @@ -186,6 +172,8 @@ void Geometry::drawImmediateMode(State& state) case(Array::Vec4ArrayType): glColor4fv(reinterpret_cast(colorPointer)); break; + default: + break; } colorPointer += colorStride; } diff --git a/src/osg/ShadowVolumeOccluder.cpp b/src/osg/ShadowVolumeOccluder.cpp index 8f962963a..1683fa3e7 100644 --- a/src/osg/ShadowVolumeOccluder.cpp +++ b/src/osg/ShadowVolumeOccluder.cpp @@ -287,10 +287,7 @@ bool ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const Convex return true; } - else - { - return false; - } + return false; } bool ShadowVolumeOccluder::contains(const std::vector& vertices) diff --git a/src/osgDB/Output.cpp b/src/osgDB/Output.cpp index dff348a2e..c494421c9 100644 --- a/src/osgDB/Output.cpp +++ b/src/osgDB/Output.cpp @@ -94,7 +94,7 @@ bool Output::getUniqueIDForObject(const osg::Object* obj,std::string& uniqueID) bool Output::createUniqueIDForObject(const osg::Object* obj,std::string& uniqueID) { char str[256]; - sprintf(str,"%s_%i",obj->className(),_objectToUniqueIDMap.size()); + sprintf(str,"%s_%i",obj->className(),(unsigned int)_objectToUniqueIDMap.size()); uniqueID = str; return true; } diff --git a/src/osgPlugins/flt/GeoSetBuilder.cpp b/src/osgPlugins/flt/GeoSetBuilder.cpp index 12598fa38..03e94533b 100644 --- a/src/osgPlugins/flt/GeoSetBuilder.cpp +++ b/src/osgPlugins/flt/GeoSetBuilder.cpp @@ -73,6 +73,8 @@ void DynGeoSet::append(DynGeoSet* source) binding = osg::GeoSet::BIND_OFF; \ list.clear(); } \ break; \ + default: \ + break; \ } DynGeoSet::DynGeoSet():osg::GeoSet() @@ -214,6 +216,7 @@ void DynGeoSet::addToGeometry(osg::Geometry* geom) case(osg::GeoSet::TRIANGLES):mode = osg::Primitive::TRIANGLES; break; case(osg::GeoSet::QUADS):mode = osg::Primitive::QUADS; break; case(osg::GeoSet::POLYGON):mode = osg::Primitive::POLYGON; break; + default: mode = osg::Primitive::POLYGON; } diff --git a/src/osgUtil/Tesselator.cpp b/src/osgUtil/Tesselator.cpp index 22557765f..023fe19af 100644 --- a/src/osgUtil/Tesselator.cpp +++ b/src/osgUtil/Tesselator.cpp @@ -156,6 +156,8 @@ void Tesselator::retesselatePolygons(osg::Geometry& geom) } break; } + default: + break; } endContour();