Hi Preet, Rui was a little cryptic is his explanation so I'll expand on it further. What you are seeing is numerical precisions issues down on the graphics card as internally the graphics card uses floats for vertices and floats for the modelview matrix.
The solution to this problem is make sure all geometry data has a local origin and use a transform node (such as an osg::MatrixTransform) that decorates your geometry and places it in world coordinates. The OSG by default uses double's for the Camera's View matrix and double's for the transform nodes and when accumulating all the matrices during the cull traversal uses doubles as well so that by the time the OSG maintains precision all the way till it passes the modelview matrix to OpenGL. Typically when you are close to your geometry the translation component of Camera's View matrix will cancel out with the translation component of your scene graph transform node, so that you end up with a final modelview passed to OpenGL with modest translation component that doesn't present any numerical precision issues, solving the precision. This approach is commonly used when tackling whole earth geospatial data, and you'll see it in action in the paged databases that VirtualPlanetBuilder creates, 3rd party NodeKit's like osgEarth use this approach as well. Robert. On 14 February 2012 02:26, Preet <[email protected]> wrote: > Hiya, > > I'm trying to draw a simple poly line from a vertex array with the > GL_LINE_STRIP primitive. When I view the object using osgviewer, it > looks like everything is alright. Once I move the camera around with > the mouse however, the lines begin to jitter, like the polyline was > made of jello (honestly can't find better description). The effect is > especially visible at higher zooms. > > I'm using large (values in the hundred-millions), high precision > numbers (doubles) for the vertices of the line strip, and I think > that's what's causing the problem (I couldn't recreate the issue using > smaller, more sane numbers from 1-500 for example, even though the > same double datatype is used to store both numbers). > > I've posted my code here: http://pastie.org/3377862 > The code only relies on STL and osg, so it should 'just compile' if > you have an osg environment setup. The relevant calls to osg are on > lines 121-141. I'm using OSG 3.0.1 on Arch Linux, kernel 3.2.x if it's > relevant. Does anyone have any ideas as to what's going on? > > > Regards, > > Pris > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

