[osg-users] second newbie question (UNCLASSIFIED)

Brian R Hill bhill22 at csc.com
Thu Mar 12 08:41:53 PDT 2009


Daniel,

We need to see what drawLines( tri, 0 ) is doing.

Brian

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose. •


-----osg-users-bounces at lists.openscenegraph.org wrote: -----


To: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
From: "Konkle, Daniel T AMRDEC/Dynetics" <Daniel.Konkle at us.army.mil>
Sent by: osg-users-bounces at lists.openscenegraph.org
Date: 03/12/2009 11:38AM
Subject: [osg-users] second newbie question (UNCLASSIFIED)

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

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list