From 8bba7c9f98faab8ca6b751ce3333e682cb4069f9 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 10 Nov 2009 12:01:28 +0000 Subject: [PATCH] Added enabling of lighting, and disabling of mipmapping to help out testing of GLES2 target --- examples/osgshape/osgshape.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/osgshape/osgshape.cpp b/examples/osgshape/osgshape.cpp index 0c37269b4..7adff20f2 100644 --- a/examples/osgshape/osgshape.cpp +++ b/examples/osgshape/osgshape.cpp @@ -20,10 +20,12 @@ #include #include #include +#include #include #include +#include #include @@ -34,21 +36,25 @@ osg::Geode* createShapes() { osg::Geode* geode = new osg::Geode(); + // --------------------------------------- // Set up a StateSet to texture the objects // --------------------------------------- osg::StateSet* stateset = new osg::StateSet(); osg::Image* image = osgDB::readImageFile( "Images/lz.rgb" ); - if (image) { osg::Texture2D* texture = new osg::Texture2D; texture->setImage(image); - stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); + texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); + stateset->setTextureAttributeAndModes(0,texture, osg::StateAttribute::ON); } + stateset->setMode(GL_LIGHTING, osg::StateAttribute::ON); + geode->setStateSet( stateset ); + float radius = 0.8f; float height = 1.0f; @@ -98,7 +104,7 @@ osg::Geode* createShapes() mesh->setVertices(vertices); mesh->setIndices(indices); geode->addDrawable(new osg::ShapeDrawable(mesh)); - + return geode; }