Re: [osg-users] second newbie question reiterated withdrawLi(UNCLASSIFIED)

2009-03-12 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Another thought...if you do have lighting enabled, your lighting normals on
the "black" triangle could be facing the opposite direction from the light
source which might explain the black color. It might also explain why when
you fiddle with the matrix transform, the triangle color shows up (i.e. the
triangle is oriented towards the light source)...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Konkle,
Daniel T AMRDEC/Dynetics
Sent: Thursday, March 12, 2009 10:40 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] second newbie question reiterated
withdrawLi(UNCLASSIFIED)

Classification:  UNCLASSIFIED 
Caveats: NONE

If i remove the matrix transform that performs the rotation for the the
right triangle, i get the correct color on my triangle.

i don't understand why.  help.

> -Original Message-
> From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
> boun...@lists.openscenegraph.org] On Behalf Of Konkle, Daniel T
> AMRDEC/Dynetics
> Sent: Thursday, March 12, 2009 11:35 AM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] second newbie question reiterated
> withdrawLin(UNCLASSIFIED)
> 
> Classification:  UNCLASSIFIED
> Caveats: NONE
> 
> I thought that this code in drawLines sets the color.
> 
> The strange thing is that the first triangle that I draw is the wrong
> color and the second triangle is the correct color and they are both
> drawn from the same geode.
> 
> i'm totally confused.
> 
> > // pass the created vertex array to the points geometry object.
> > linesGeom->setVertexArray(vertices);
> >
> > // set the colors as before, plus using the above
> > osg::Vec4Array* colors = new osg::Vec4Array;
> > colors->push_back(osg::Vec4( colorVec[colorIndex][0],
> > colorVec[colorIndex][1],
> > colorVec[colorIndex][2], colorVec[colorIndex][3]));
> >
> > linesGeom->setColorArray(colors);
> > linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
> >
> 
> 
> > -Original Message-
> > From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
> > boun...@lists.openscenegraph.org] On Behalf Of Tomlinson, Gordon
> > Sent: Thursday, March 12, 2009 11:11 AM
> > To: OpenSceneGraph Users
> > Subject: Re: [osg-users] second newbie question reiterated
> > withdrawLine(UNCLASSIFIED)
> >
> > You do not show how you set the color and material on the triangles
> > If this is not specified then you will pickup what ever the last
> color
> > and/or material that was used by Opengl
> >
> >
> > Gordon
> > Product Manager 3d
> > __
> > Gordon Tomlinson
> > Email  : gtomlinson @ overwatch.textron.com
> > __
> >
> >
> > -Original Message-
> > From: osg-users-boun...@lists.openscenegraph.org
> > [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
> > Konkle,
> > Daniel T AMRDEC/Dynetics
> > Sent: Thursday, March 12, 2009 12:04 PM
> > To: OpenSceneGraph Users
> > Subject: [osg-users] second newbie question reiterated with
> > drawLine(UNCLASSIFIED)
> >
> > Classification:  UNCLASSIFIED
> > Caveats: NONE
> >
> >
> > Any 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 triangle = new osg::Geode();
> > triangle->addDrawable( drawLines( tri, 0 ) );
> >
> >  // right triangle
> > {
> >
> >osg::ref_ptr translate = new
> > osg::MatrixTransform;
> >osg::Matrix tran_mat = osg::Matrix::translate(
> hud_aspect,0.0f,
> > 0.0f );
> >transla

Re: [osg-users] second newbie question reiterated withdrawLi(UNCLASSIFIED)

2009-03-12 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Are you rendering with lighting enabled or disabled? 

I notice that along with setting the color array, you are setting a normal
array in your code below. Normally (no pun intended) you supply a normal
array if lighting is enabled...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Konkle,
Daniel T AMRDEC/Dynetics
Sent: Thursday, March 12, 2009 10:40 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] second newbie question reiterated
withdrawLi(UNCLASSIFIED)

Classification:  UNCLASSIFIED 
Caveats: NONE

If i remove the matrix transform that performs the rotation for the the
right triangle, i get the correct color on my triangle.

i don't understand why.  help.

> -Original Message-
> From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
> boun...@lists.openscenegraph.org] On Behalf Of Konkle, Daniel T
> AMRDEC/Dynetics
> Sent: Thursday, March 12, 2009 11:35 AM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] second newbie question reiterated
> withdrawLin(UNCLASSIFIED)
> 
> Classification:  UNCLASSIFIED
> Caveats: NONE
> 
> I thought that this code in drawLines sets the color.
> 
> The strange thing is that the first triangle that I draw is the wrong
> color and the second triangle is the correct color and they are both
> drawn from the same geode.
> 
> i'm totally confused.
> 
> > // pass the created vertex array to the points geometry object.
> > linesGeom->setVertexArray(vertices);
> >
> > // set the colors as before, plus using the above
> > osg::Vec4Array* colors = new osg::Vec4Array;
> > colors->push_back(osg::Vec4( colorVec[colorIndex][0],
> > colorVec[colorIndex][1],
> > colorVec[colorIndex][2], colorVec[colorIndex][3]));
> >
> > linesGeom->setColorArray(colors);
> > linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
> >
> 
> 
> > -Original Message-
> > From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
> > boun...@lists.openscenegraph.org] On Behalf Of Tomlinson, Gordon
> > Sent: Thursday, March 12, 2009 11:11 AM
> > To: OpenSceneGraph Users
> > Subject: Re: [osg-users] second newbie question reiterated
> > withdrawLine(UNCLASSIFIED)
> >
> > You do not show how you set the color and material on the triangles
> > If this is not specified then you will pickup what ever the last
> color
> > and/or material that was used by Opengl
> >
> >
> > Gordon
> > Product Manager 3d
> > __
> > Gordon Tomlinson
> > Email  : gtomlinson @ overwatch.textron.com
> > __
> >
> >
> > -Original Message-
> > From: osg-users-boun...@lists.openscenegraph.org
> > [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
> > Konkle,
> > Daniel T AMRDEC/Dynetics
> > Sent: Thursday, March 12, 2009 12:04 PM
> > To: OpenSceneGraph Users
> > Subject: [osg-users] second newbie question reiterated with
> > drawLine(UNCLASSIFIED)
> >
> > Classification:  UNCLASSIFIED
> > Caveats: NONE
> >
> >
> > Any 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 triangle = new osg::Geode();
> > triangle->addDrawable( drawLines( tri, 0 ) );
> >
> >  // right triangle
> > {
> >
> >osg::ref_ptr translate = new
> > osg::MatrixTransform;
> >osg::Matrix tran_mat = osg::Matrix::translate(
> hud_aspect,0.0f,
> > 0.0f );
> >translate->setMatrix( tran_mat );
> >
> >osg::ref_ptr rotate = new
> > osg::MatrixTransform;
> >osg::Matrix rot_mat = o

Re: [osg-users] second newbie question reiterated withdrawLi (UNCLASSIFIED)

2009-03-12 Thread Konkle, Daniel T AMRDEC/Dynetics
Classification:  UNCLASSIFIED 
Caveats: NONE

If i remove the matrix transform that performs the rotation for the the
right triangle, i get the correct color on my triangle.

i don't understand why.  help.

> -Original Message-
> From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
> boun...@lists.openscenegraph.org] On Behalf Of Konkle, Daniel T
> AMRDEC/Dynetics
> Sent: Thursday, March 12, 2009 11:35 AM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] second newbie question reiterated
> withdrawLin(UNCLASSIFIED)
> 
> Classification:  UNCLASSIFIED
> Caveats: NONE
> 
> I thought that this code in drawLines sets the color.
> 
> The strange thing is that the first triangle that I draw is the wrong
> color and the second triangle is the correct color and they are both
> drawn from the same geode.
> 
> i'm totally confused.
> 
> > // pass the created vertex array to the points geometry object.
> > linesGeom->setVertexArray(vertices);
> >
> > // set the colors as before, plus using the above
> > osg::Vec4Array* colors = new osg::Vec4Array;
> > colors->push_back(osg::Vec4( colorVec[colorIndex][0],
> > colorVec[colorIndex][1],
> > colorVec[colorIndex][2], colorVec[colorIndex][3]));
> >
> > linesGeom->setColorArray(colors);
> > linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
> >
> 
> 
> > -Original Message-
> > From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-
> > boun...@lists.openscenegraph.org] On Behalf Of Tomlinson, Gordon
> > Sent: Thursday, March 12, 2009 11:11 AM
> > To: OpenSceneGraph Users
> > Subject: Re: [osg-users] second newbie question reiterated
> > withdrawLine(UNCLASSIFIED)
> >
> > You do not show how you set the color and material on the triangles
> > If this is not specified then you will pickup what ever the last
> color
> > and/or material that was used by Opengl
> >
> >
> > Gordon
> > Product Manager 3d
> > __
> > Gordon Tomlinson
> > Email  : gtomlinson @ overwatch.textron.com
> > __
> >
> >
> > -Original Message-
> > From: osg-users-boun...@lists.openscenegraph.org
> > [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
> > Konkle,
> > Daniel T AMRDEC/Dynetics
> > Sent: Thursday, March 12, 2009 12:04 PM
> > To: OpenSceneGraph Users
> > Subject: [osg-users] second newbie question reiterated with
> > drawLine(UNCLASSIFIED)
> >
> > Classification:  UNCLASSIFIED
> > Caveats: NONE
> >
> >
> > Any 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 triangle = new osg::Geode();
> > triangle->addDrawable( drawLines( tri, 0 ) );
> >
> >  // right triangle
> > {
> >
> >osg::ref_ptr translate = new
> > osg::MatrixTransform;
> >osg::Matrix tran_mat = osg::Matrix::translate(
> hud_aspect,0.0f,
> > 0.0f );
> >translate->setMatrix( tran_mat );
> >
> >osg::ref_ptr 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 mt = new
> > osg::MatrixTransform;
> >m.makeTranslate( -hud_aspect, 0.0f, 0.0f );
> >mt->setMatrix( m );
> >camera->addChild(mt.get());
> >mt->addChild( triangle.get() );.
> > }
> >
> >
> > // create LINES
> > osg::Geometry * drawLines( osg::Vec3Array * vertices, int colorIndex
> )
> > {
> > // create Geometry object to store all the vertices and lines
> > primitive.
> > osg::Geometry* linesGeom = new osg::Geometry();
> >
> > // pass the created vertex array to the points geometry object.
> > linesGeom->setVertexArray(vertices);
> >
> > // set the colors as before, plus using the above
> > osg::Vec4Array* colors = new osg::Vec4Array;
> > colors->push_back(osg::Vec4( colorVec[colorIndex][0],
> > colorVec[colorIndex][1],
> > colorVec[colorIndex][2], colorVec[colorIndex][3]));
> >
> > linesGeom->setColorArray(colors);
> > linesGe