At 16:46 10/10/2006, you wrote:

hi all,

i have a geode with a geometry-node in my scene which has attached an osg::PrimitiveSet::QUADS. i put a tga-texture on that quad using a osg::stateset. if i use a tga-texture with a background i can see the whole quad in my scene (a square). but then i wanted to change the texture to a texture without a background (alpha-blending?!) i did this but now i cant see my quad in the scene anymore even though i checked - it exists. what is wrong? how is it possible to put a texture on a quad which does has a background so i just a the actual shape of the content of the image not the quad shape...

here is what i did:

  // specify texture
  dtCore::RefPtr<osg::Texture2D> shoeTex = new osg::Texture2D;
  // protect from being optimized away as static state:
  shoeTex->setDataVariance(osg::Object::DYNAMIC);

  // load an image by reading a file:
  dtCore::RefPtr<osg::Image> shoeImg = osgDB::readImageFile( texName );
  if (!shoeImg.get())
  {
     std::cout << " couldn't find texture, quiting." << std::endl;
  }

  // Assign the texture to the image we read from file:
  shoeTex->setImage(shoeImg.get());

  // Create a new StateSet with default settings:
  dtCore::RefPtr<osg::StateSet> stateOne = new osg::StateSet();

  stateOne->setMode( GL_BLEND, osg::StateAttribute::ON );

  // Assign texture unit 0 of our new StateSet to the texture
  // enable the texture.
stateOne->setTextureAttributeAndModes(0, shoeTex.get(), osg::StateAttribute::ON);

  geode->setStateSet(stateOne.get());

thanks in advance.

_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to