Using ALTMODE_RELATIVE with 2D Lines #1855
-
Hi, I currently have this kind of structure for 2D Lines being drawn: GeoTransform GeoLine = new GeoTransform;
osg::Geometry Line = new osg::Geometry();
osg::Group LineGroup = new osg::Group();
Line->setVertexArray(osg::Vec3Array());
GeoLine->addChild (Line);
GeoLine->setPosition (GeoPoint (GeoGraphicSRS, Lon, Lat, Alt, ALTMODE_RELATIVE));
LineGroup->addChild (GeoLine); I have a lot of these osg::Geometry objects as children to the GeoTransform object and I am updating them constantly using an UpdateOperation on the viewer. The way it is set up is the GeoTransform is removed from the group at the beginning of the update function and then the function that draws the lines is called and the GeoTransform is re-added to the group which is apart of the MapNode elsewhere. I have a condition in this update function where it stops updating the data for these lines. When I do this, I do not see the the lines drawing with the relative altitude until after the data updating stops. So what I want to know is:
Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello Miles. I must admit that I fail to grok your explanation of removing nodes, drawing them, re-inserting, and stopping updates. So I cannot comment on whether this setup is exacerbating the problem. |
Beta Was this translation helpful? Give feedback.
Hello Miles.
The GeoTransform processes an ALTMODE_RELATIVE by sampling the terrain. In order to do that it just find a pointer to the terrain engine, which happens automatically during the next UPDATE traversal. If you don't want to wait, you can call GeoTransform::setTerrain to do it manually; then calling setPosition will have immediate effect. Otherwise there may be a one-frame delay. Maybe that's what you are seeing.
I must admit that I fail to grok your explanation of removing nodes, drawing them, re-inserting, and stopping updates. So I cannot comment on whether this setup is exacerbating the problem.