<div dir="ltr">if you need to draw anything on the center of the screen in front of something else, then your problem is to create an ortho camera and have your geometry there - something like HUD. The osghud example shows how to do this. Just for a test, you can use the createHUD() function from that sample to create your screen geometry in front of the osgEarth globe</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 2, 2018 at 4:23 PM, Ali Ozdin <span dir="ltr"><<a href="mailto:alinailozdin@gmail.com" target="_blank">alinailozdin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I could not relate the example with my question. I am using osgEarth.<br>
Can you be more expressive what causes this?<br>
<br>
Thanks,<br>
<span class=""><br>
<br>
Trajce Nikolov NICK wrote:<br>
> Hi Ali,<br>
><br>
> have a look at the osghud example from the osg repo<br>
><br>
><br>
</span><div><div class="h5">> On Fri, Mar 2, 2018 at 1:44 PM, Ali Ozdin < ()> wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > I drew an osg Node and I want to put it on the center of the screen like any labelControl. How can I do that? I put a sample code below.<br>
> ><br>
> > If I change the line from<br>
> ><br>
> > Code:<br>
> > viewer.setSceneData( mainGroup );<br>
> ><br>
> >  to<br>
> > Code:<br>
> > viewer.setSceneData( nn.get() );<br>
> ><br>
> ><br>
> > and remove these two lines<br>
> ><br>
> > Code:<br>
> > manipulator = new EarthManipulator(  arguments );<br>
> > viewer.setCameraManipulator( manipulator );<br>
> ><br>
> ><br>
> ><br>
> > I am only able to see the geometry which I draw. However if I setSceneData as mapNode and geometry which are in "mainGroup" and if my camera manipulator is EarthManipulator; I am only able to see the earth.<br>
> > To sum up, I want to see the earth in the back and I want to put my geometry front of the earth and on the center of the screen.<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > Code:<br>
> > osg::ref_ptr<osg::Node> createSceneGraph()<br>
> > {<br>
> > osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;<br>
> > osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;<br>
> > geom->setVertexArray( v.get() );<br>
> ><br>
> > //horizontal<br>
> > v->push_back( osg::Vec3( -1.f, 1.f, 0.f ) );<br>
> > v->push_back( osg::Vec3( -0.6f, 1.f, 0.f ) );<br>
> > v->push_back( osg::Vec3( -0.4f, 1.f, 0.f ) );<br>
> > v->push_back( osg::Vec3( 0.f, 1.f, 0.f ) );<br>
> ><br>
> > //vertical<br>
> > v->push_back( osg::Vec3( -0.5f, 1.f, 0.5f ) );<br>
> > v->push_back( osg::Vec3( -0.5f, 1.f, 0.1f ) );<br>
> > v->push_back( osg::Vec3( -0.5f, 1.f, -0.5f ) );<br>
> > v->push_back( osg::Vec3( -0.5f, 1.f, -0.1f ) );<br>
> ><br>
> ><br>
> > osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array;<br>
> > geom->setColorArray( c.get() );<br>
> > geom->setColorBinding( osg::Geometry::BIND_OVERALL );<br>
> > c->push_back( osg::Vec4( 1.f, 1.f, 1.f, 1.f ) );<br>
> ><br>
> > osg::ref_ptr<osg::Vec3Array> n = new osg::Vec3Array;<br>
> > geom->setNormalArray( n.get() );<br>
> > geom->setNormalBinding( osg::Geometry::BIND_OVERALL );<br>
> > n->push_back( osg::Vec3( 0.f, -1.f, 0.f ) );<br>
> ><br>
> > osg::LineWidth* linewdth = new osg::LineWidth();<br>
> > linewdth->setWidth(25.0);<br>
> > geom->getOrCreateStateSet()-><wbr>setAttributeAndModes( linewdth, osg::StateAttribute::ON ) ;<br>
> > geom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 8 ) );<br>
> ><br>
> > osg::ref_ptr<osg::Geode> geode = new osg::Geode;<br>
> > geode->addDrawable( geom.get() );<br>
> > return geode.get();<br>
> > }<br>
> ><br>
> > int main(int argc, char** argv)<br>
> > {<br>
> > osg::ArgumentParser arguments(&argc,argv);<br>
> > viewer.setUpViewInWindow(100,<wbr>100,500,500);<br>
> > viewer.getDatabasePager()-><wbr>setUnrefImageDataAfterApplyPol<wbr>icy( true, false );<br>
> > osgDB::Registry::instance()-><wbr>getObjectWrapperManager()-><wbr>findWrapper("osg::Image");<br>
> > manipulator = new EarthManipulator( arguments );<br>
> > viewer.setCameraManipulator( manipulator );<br>
> ><br>
> > osg::Group* mainGroup = new osg::Group();<br>
> > osg::Group* group = MapNodeHelper().load(<wbr>arguments, &viewer);<br>
> > osg::ref_ptr<osg::Node> nn = createSceneGraph();<br>
> ><br>
> > mainGroup->addChild(nn.get());<br>
> > mainGroup->addChild(group);<br>
> ><br>
> > viewer.setSceneData( mainGroup );<br>
> > viewer.run();<br>
> > }<br>
> ><br>
> ><br>
> ><br>
> > Thank you!<br>
> ><br>
> > Cheers,<br>
> > Ali<br>
> ><br>
> > ------------------<br>
> > Read this topic online here:<br>
</div></div>> > <a href="http://forum.openscenegraph.org/viewtopic.php?p=72998#72998" rel="noreferrer" target="_blank">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=72998#<wbr>72998</a> (<a href="http://forum.openscenegraph.org/viewtopic.php?p=72998#72998" rel="noreferrer" target="_blank">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=72998#<wbr>72998</a>)<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > osg-users mailing list<br>
> >  ()<br>
> > <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a> (<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a>)<br>
> ><br>
><br>
><br>
><br>
><br>
> --<br>
> trajce nikolov nick<br>
><br>
>  ------------------<br>
> Post generated by Mail2Forum<br>
<span class=""><br>
<br>
------------------<br>
Read this topic online here:<br>
</span><a href="http://forum.openscenegraph.org/viewtopic.php?p=73000#73000" rel="noreferrer" target="_blank">http://forum.openscenegraph.<wbr>org/viewtopic.php?p=73000#<wbr>73000</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>
</div>