Hi people. Help out. I’ve been tormented for two days. It is necessary to draw 
a simple line at a great distance from the origin. If all points of the line 
are close to 0, then everything is fine.
Good case. Regardless of the position of the camera, everything is fine:

Code:

osg::Node* createMyScene()
{
osg::Geode* geode = new osg::Geode();
osg::Geometry* linesGeom = new osg::Geometry();
osg::Vec3Array* vertices = new osg::Vec3Array(5);
osg::Vec3Array::iterator vitr = vertices->begin();
(vitr++)->set(0., 0., 0.);
(vitr++)->set(1., 0., 0.);
(vitr++)->set(2., 0., 0.);
(vitr++)->set(3., 0., 0.);
(vitr++)->set(4., 0., 0.);

linesGeom->setVertexArray(vertices);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f));
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 
0, 5));
geode->addDrawable(linesGeom);
geode->getOrCreateStateSet()->setMode(GL_LIGHTING,      
osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);
return geode;
}


[Image: 
https://cdn1.savepice.ru/uploads/2019/11/10/b0dcc9e5e9394080536e2d4e8d75ef20-full.png
 ]

If the point is far from 0, I observe a terrible picture. The line display is 
unstable. When the camera position changes, everything trembles and the line 
constantly changes, although it should be straight:

Code:

//same
(vitr++)->set(0., 2000000., 0.);
(vitr++)->set(1., 2000000., 0.);
(vitr++)->set(2., 2000000., 0.);
(vitr++)->set(3., 2000000., 0.);
(vitr++)->set(4., 2000000., 0.);
//same



[Image: 
https://cdn1.savepice.ru/uploads/2019/11/10/8db5e0e550dd9139d4fd5970932904e5-full.png
 ]

The problem is more relevant if you use "osgEarth" in your application. So the 
distance is ~ 6.300.000 from the surface to the center of the coordinate 
system. Short lines look awful.

What could be the problem, maybe there is some kind of solution out of the box?


Thank you!

Cheers,
Alex

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76891#76891





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

Reply via email to