This method also creates geometry, I think those guys are trying to avoid geometry creation. I think the class osg::DrawPixels can do the trick, but I never tried it.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-S?bastien Guay Sent: Monday, February 18, 2008 12:34 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Loading an image file Hello Per, > I too need to show images. Since osg is (and should be) 3d-based, the > way to do is seemed to be to display a rectange Geometry infront of an > orthographic camera, and set the rectangle texture to be the image. To that end, there is a utility function in the Geometry header. #include <osg/Geometry> osg::Geode* createNodeWithMyImageOnIt(const std::string& filename) { osg::Geode* geode = new osg::Geode; osg::Geometry* geometry = osg::createTexturedQuadGeometry(osg::Vec3(0,0,0), osg::Vec3(1,0,0), osg::Vec3(0,0,1), 0, 0, 1, 1); geode->addDrawable(geometry); osg::Texture2D* texture = new osg::Texture2D(osgDB::readImageFile(filename)); geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); geode->getOrCreateStateSet()->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::ON); return geode; } Note this is off the top of my head, untested, possibly incomplete. But it should give you an idea. Look up the doxygen for osg::createTexturedQuadGeometry for details. Hope this helps, J-S -- ______________________________________________________ Jean-Sebastien Guay [EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

