[osg-users] second newbie question (UNCLASSIFIED)

Konkle, Daniel T AMRDEC/Dynetics Daniel.Konkle at us.army.mil
Thu Mar 12 08:38:06 PDT 2009


Classification:  UNCLASSIFIED 
Caveats: NONE


In insight would be welcome.

So I'm drawing several triangles on my scene.

here is the code that draws the first 2.

I'm reusing the first same geode.

The strange thing is that the 'right triangle' is a different color
(black)
than the 'left triangle' (light green)

I'm actually drawing 2 others and they are black too.

I need them to be green.

Can anyone tell me what I'm doing wrong?  It makes no sense to me.

Danny


      osg::Vec3Array* tri = new osg::Vec3Array;
      tri->push_back(osg::Vec3(0.0f, -0.1f, depth));
	tri->push_back(osg::Vec3(0.1f, 0.0f, depth));
	tri->push_back(osg::Vec3(0.0f, 0.1f, depth));

      osg::ref_ptr<osg::Geode> triangle = new osg::Geode();
	triangle->addDrawable( drawLines( tri, 0 ) );
	
      // right triangle
	{

	    osg::ref_ptr<osg::MatrixTransform> translate = new
osg::MatrixTransform;
	    osg::Matrix tran_mat = osg::Matrix::translate( hud_aspect,
0.0f, 0.0f );
	    translate->setMatrix( tran_mat );

	    osg::ref_ptr<osg::MatrixTransform> rotate = new
osg::MatrixTransform;
	    osg::Matrix rot_mat = osg::Matrix::rotate( M_PI, 0.0f, 0.0f,
1.0f);
	    rotate->setMatrix( rot_mat );

	    camera->addChild(translate.get());
	    translate->addChild( rotate.get() );
	    rotate->addChild( triangle.get() );
	}

	// left triangle
	{
	    osg::Matrix m;
	    osg::ref_ptr<osg::MatrixTransform> mt = new
osg::MatrixTransform;
	    m.makeTranslate( -hud_aspect, 0.0f, 0.0f );
	    mt->setMatrix( m );
	    camera->addChild(mt.get());
	    mt->addChild( triangle.get() );
	}

Classification:  UNCLASSIFIED 
Caveats: NONE




More information about the osg-users mailing list