diff --git a/examples/osgtexture3D/osgtexture3D.cpp b/examples/osgtexture3D/osgtexture3D.cpp index 4b31fb0d1..32cabf6c7 100644 --- a/examples/osgtexture3D/osgtexture3D.cpp +++ b/examples/osgtexture3D/osgtexture3D.cpp @@ -31,11 +31,9 @@ #include // -// A simple demo demonstrating different texturing modes, -// including using of texture extensions. +// A simple demo demonstrating use osg::Texture3D to create a blended animation between four seperate images packed together into a 3d texture // - typedef std::vector< osg::ref_ptr > ImageList; osg::StateSet* createState() @@ -176,27 +174,16 @@ osg::Drawable* createSquare(float textureCoordMax=1.0f) osg::Node* createModel() { - // create the geometry of the model, just a simple 2d quad right now. osg::Geode* geode = new osg::Geode; + geode->addDrawable(createSquare()); - // normally we'd create the stateset's to contain all the textures - // etc here, but, the above technique uses osg::Image::scaleImage and - // osg::Image::copySubImage() which are implemented with OpenGL utility - // library, which unfortunately can't be used until we have a valid - // OpenGL context, and at this point in initilialization we don't have - // a valid OpenGL context, so we have to delay creation of state until - // there is a valid OpenGL context. I'll manage this by using an - // app callback which will create the state during the first traversal. - // A bit hacky, and my plan is to reimplement the osg::scaleImage and - // osg::Image::copySubImage() without using GLU which will get round - // this current limitation. geode->setUpdateCallback(new UpdateStateCallback()); + geode->setStateSet(createState()); return geode; - }