Lighting is enabled, which is why the line darkens based on camera position. Disable lighting on line_geometry. Search osg examples for GL_LIGHTING to see how.
--- Ravi Sent from my phone, please excuse my brevity. On Sun, Dec 23, 2018, 4:46 PM Diego Mancilla <dmancil...@gmail.com wrote: > Hello, > > I'm drawing some simple lines on osg. So far I have successfully draw the > lines and set a single color for each of them... but when I rotate the view > the color is shown only on one direction of the camera, for instance, if > rotate on 180 degrees the view, all lines are shown in black (looking from > "down")... how can I get that the color of the lines is correctly shown > regardless of the position/orientation of the camera on the viewer? > > > > Code: > osg::Geode * root = getRoot(); > osg::Vec4Array * color = new osg::Vec4Array; > double r, g, b, a; > r = 1.0; > g = 0.0; > b = 0.0; > a = 1.0; > color->push_back(osg::Vec4d(r, g, b, a)); //single color > osg::Vec3Array* osg_points = new osg::Vec3Array; > ... > Here I fill the vertex array > ... > osg::Geometry* line_geometry = new osg::Geometry; > line_geometry->setVertexArray(osg_points); //osg_points has the points of > the lines > line_geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, > osg_points->size())); > line_geometry->setColorArray(color); > line_geometry->setColorBinding(osg::Geometry::BIND_OVERALL); > root->addDrawable(line_geometry); > > > > Thank you! > > Cheers, > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=75341#75341 > > > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org