Hello, i tried to place some treebillboards in my Terrain, but i have problems with the texturing.
I have two textures: [Image: http://www.husseini.de/markus/C.jpg ] [Image: http://www.husseini.de/markus/T.jpg ] If I render the billboard the black color should be invisible but it doesn't work. I get this code from the Osg Help Tutorials. m_refTexPencil = new osg::Texture2D; m_refTexPencil->setImage( osgDB::readImageFile( _Pencil ) ); m_refTexCracks = new osg::Texture2D; m_refTexCracks->setImage( osgDB::readImageFile( _Cracks ) ); m_refGeo = new osg::Geometry; m_refVerts = new osg::Vec3Array; m_refVerts->push_back( osg::Vec3( 0, 0, 0 )+vecPos ); m_refVerts->push_back( osg::Vec3( 100, 0, 0 )+vecPos ); m_refVerts->push_back( osg::Vec3( 100, 0, 100 )+vecPos ); m_refVerts->push_back( osg::Vec3( 0, 0, 100 )+vecPos ); m_refGeo->setVertexArray( m_refVerts ); m_refPrimitiveSet = new osg::DrawElementsUInt( osg::PrimitiveSet::QUADS, 0 ); m_refPrimitiveSet->push_back( 3 ); m_refPrimitiveSet->push_back( 2 ); m_refPrimitiveSet->push_back( 1 ); m_refPrimitiveSet->push_back( 0 ); m_refGeo->addPrimitiveSet( m_refPrimitiveSet ); m_refTexCoords = new osg::Vec2Array( 4 ); (*m_refTexCoords)[0].set( 0.0f, 0.0f ); (*m_refTexCoords)[1].set( 1.0f, 0.0f ); (*m_refTexCoords)[2].set( 1.0f, 1.0f ); (*m_refTexCoords)[3].set( 0.0f, 1.0f ); m_refGeo->setTexCoordArray( 0, m_refTexCoords ); m_refGeo->setTexCoordArray( 1, m_refTexCoords ); m_refBillboard = new osg::Billboard; m_refBillboard->setMode( osg::Billboard::AXIAL_ROT );//POINT_ROT_EYE ); m_refStateSet = m_refBillboard->getOrCreateStateSet(); m_refStateSet->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); m_refStateSet->setMode( GL_BLEND, osg::StateAttribute::ON ); m_refStateSet->setMode( GL_CULL_FACE, osg::StateAttribute::OFF ); m_refStateSet->setTextureAttributeAndModes( 0, m_refTexPencil, osg::StateAttribute::ON ); m_refStateSet->setTextureAttributeAndModes( 1, m_refTexCracks, osg::StateAttribute::ON ); m_refBillboard->addDrawable( m_refGeo ); m_refTexEnv = new osg::TexEnvCombine; m_refTexEnv->setCombine_RGB( osg::TexEnvCombine::MODULATE ); m_refTexEnv->setSource0_RGB( osg::TexEnvCombine::TEXTURE0 ); m_refTexEnv->setOperand0_RGB( osg::TexEnvCombine::SRC_COLOR); m_refTexEnv->setSource1_RGB( osg::TexEnvCombine::TEXTURE1 ); m_refTexEnv->setOperand1_RGB( osg::TexEnvCombine::SRC_COLOR ); m_refStateSet->setTextureAttribute( 1, m_refTexEnv ); m_refPat = new osg::PositionAttitudeTransform; m_refPat->setPosition( vecPos ); m_refPat->addChild( m_refBillboard ); Thx for Help. ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15865#15865 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

