[osg-users] second newbie question reiterated withdrawLin (UNCLASSIFIED)

Ulrich Hertlein u.hertlein at sandbox.de
Thu Mar 12 18:52:04 PDT 2009

Hi Daniel,

On 13/3/09 3:34 AM, Konkle, Daniel T AMRDEC/Dynetics wrote:
> 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.
>>       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::Matrix rot_mat = osg::Matrix::rotate( M_PI, 0.0f, 0.0f, 1.0f);
>>         rotate->setMatrix( rot_mat );
>>      // set the normal in the same way color.
>>      osg::Vec3Array* normals = new osg::Vec3Array;
>>      normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
>>      linesGeom->setNormalArray(normals);
>>      linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);

Could it be your normal is wrong?
Your object is constructed in the X/Y plane but has a normal of osg::Vec3(0,-1,0) i.e. -Y.
Try it with a +Z normal i.e. osg::Vec(0,0,1).

Hope this helps,

More information about the osg-users mailing list