Re: [osg-users] osg::Node can not be displayed front of the Earth on the screen
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 On Fri, Mar 2, 2018 at 4:23 PM, Ali Ozdinwrote: > I could not relate the example with my question. I am using osgEarth. > Can you be more expressive what causes this? > > Thanks, > > > Trajce Nikolov NICK wrote: > > Hi Ali, > > > > have a look at the osghud example from the osg repo > > > > > > On Fri, Mar 2, 2018 at 1:44 PM, Ali Ozdin < ()> wrote: > > > > > Hi, > > > > > > 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. > > > > > > If I change the line from > > > > > > Code: > > > viewer.setSceneData( mainGroup ); > > > > > > to > > > Code: > > > viewer.setSceneData( nn.get() ); > > > > > > > > > and remove these two lines > > > > > > Code: > > > manipulator = new EarthManipulator( arguments ); > > > viewer.setCameraManipulator( manipulator ); > > > > > > > > > > > > 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. > > > 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. > > > > > > > > > > > > > > > Code: > > > osg::ref_ptr createSceneGraph() > > > { > > > osg::ref_ptr geom = new osg::Geometry; > > > osg::ref_ptr v = new osg::Vec3Array; > > > geom->setVertexArray( v.get() ); > > > > > > //horizontal > > > v->push_back( osg::Vec3( -1.f, 1.f, 0.f ) ); > > > v->push_back( osg::Vec3( -0.6f, 1.f, 0.f ) ); > > > v->push_back( osg::Vec3( -0.4f, 1.f, 0.f ) ); > > > v->push_back( osg::Vec3( 0.f, 1.f, 0.f ) ); > > > > > > //vertical > > > v->push_back( osg::Vec3( -0.5f, 1.f, 0.5f ) ); > > > v->push_back( osg::Vec3( -0.5f, 1.f, 0.1f ) ); > > > v->push_back( osg::Vec3( -0.5f, 1.f, -0.5f ) ); > > > v->push_back( osg::Vec3( -0.5f, 1.f, -0.1f ) ); > > > > > > > > > osg::ref_ptr c = new osg::Vec4Array; > > > geom->setColorArray( c.get() ); > > > geom->setColorBinding( osg::Geometry::BIND_OVERALL ); > > > c->push_back( osg::Vec4( 1.f, 1.f, 1.f, 1.f ) ); > > > > > > osg::ref_ptr n = new osg::Vec3Array; > > > geom->setNormalArray( n.get() ); > > > geom->setNormalBinding( osg::Geometry::BIND_OVERALL ); > > > n->push_back( osg::Vec3( 0.f, -1.f, 0.f ) ); > > > > > > osg::LineWidth* linewdth = new osg::LineWidth(); > > > linewdth->setWidth(25.0); > > > geom->getOrCreateStateSet()->setAttributeAndModes( linewdth, > osg::StateAttribute::ON ) ; > > > geom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, > 0, 8 ) ); > > > > > > osg::ref_ptr geode = new osg::Geode; > > > geode->addDrawable( geom.get() ); > > > return geode.get(); > > > } > > > > > > int main(int argc, char** argv) > > > { > > > osg::ArgumentParser arguments(,argv); > > > viewer.setUpViewInWindow(100,100,500,500); > > > viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, > false ); > > > osgDB::Registry::instance()->getObjectWrapperManager()-> > findWrapper("osg::Image"); > > > manipulator = new EarthManipulator( arguments ); > > > viewer.setCameraManipulator( manipulator ); > > > > > > osg::Group* mainGroup = new osg::Group(); > > > osg::Group* group = MapNodeHelper().load(arguments, ); > > > osg::ref_ptr nn = createSceneGraph(); > > > > > > mainGroup->addChild(nn.get()); > > > mainGroup->addChild(group); > > > > > > viewer.setSceneData( mainGroup ); > > > viewer.run(); > > > } > > > > > > > > > > > > Thank you! > > > > > > Cheers, > > > Ali > > > > > > -- > > > Read this topic online here: > > > http://forum.openscenegraph.org/viewtopic.php?p=72998#72998 ( > http://forum.openscenegraph.org/viewtopic.php?p=72998#72998) > > > > > > > > > > > > > > > > > > ___ > > > osg-users mailing list > > > () > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users- > openscenegraph.org (http://lists.openscenegraph. > org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > > > > -- > > trajce nikolov nick > > > > -- > > Post generated by Mail2Forum > > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=73000#73000 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org
Re: [osg-users] Read frame buffer back into main memory
Hi Antoine, You can just do your glReadPixels(..) or osg::Image::readPixels(..) in your own Camera::DrawCallback that you attach as a post draw callback to your camera. Robert. On 2 March 2018 at 16:12, Antoine Rennuitwrote: > Hi all, > > Hum, it seems my case is a bit more complex than expected. The camera I want > to read the buffer from is a custom created camera: > > > Code: > // Curvatures camera. > m_curvaturesCamera = new osg::Camera(); > m_curvaturesCamera->setClearMask(GL_DEPTH_BUFFER_BIT); // The camera only > clears the depth buffer before rendering (not the color buffer). > m_curvaturesCamera->setRenderOrder(osg::Camera::PRE_RENDER); > m_curvaturesCamera->setReferenceFrame(osg::Camera::RELATIVE_RF); > > > > > I have had a look at osg::Image, but it does not seem very clear which > function to use and above all, how I shall indicate to the osg::image which > camera it needs to read from. > > Any idea? > > Thank you! > > Cheers, > > Antoine.[/code] > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=73002#73002 > > > > > > ___ > 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
Re: [osg-users] Can see parts of the back side of a model
Hi Sebastian, On 2 March 2018 at 15:44, Sebastian Schmidtwrote: > Hi, i have a similar problem and dont want to create a new thread. > > Unfortunately i couldnt fix the problem with these solutions here. It's a different problem then, so worthy of it's own thread. It'll be a different problem with a different solution. Could you start a fresh thread and if possible give a bit more background the model, and how you are rendering it. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Geode is not seen when added as child on osgEarth
On 2 March 2018 at 12:43, Ali Ozdinwrote: > Any idea? This is an osgEarth question so only users/developers of osgEarth will be able to provide an answer. Many of the osgEarh community are here in the main osg-users community as well but perhaps less active on osgEarth topics than they would be within the osgEarth forum, so if you don't get a quick answer try there. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Read frame buffer back into main memory
Hi all, Hum, it seems my case is a bit more complex than expected. The camera I want to read the buffer from is a custom created camera: Code: // Curvatures camera. m_curvaturesCamera = new osg::Camera(); m_curvaturesCamera->setClearMask(GL_DEPTH_BUFFER_BIT); // The camera only clears the depth buffer before rendering (not the color buffer). m_curvaturesCamera->setRenderOrder(osg::Camera::PRE_RENDER); m_curvaturesCamera->setReferenceFrame(osg::Camera::RELATIVE_RF); I have had a look at osg::Image, but it does not seem very clear which function to use and above all, how I shall indicate to the osg::image which camera it needs to read from. Any idea? Thank you! Cheers, Antoine.[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73002#73002 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can see parts of the back side of a model
Hi, i have a similar problem and dont want to create a new thread. Unfortunately i couldnt fix the problem with these solutions here. What you can see is the back of a plane with enabled front (transparency) or back (black/no lightning) face culling.[/img] OSG Version: 3.4.1 OS: OpenSuse Leap 42.1 -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73001#73001 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Node can not be displayed front of the Earth on the screen
I could not relate the example with my question. I am using osgEarth. Can you be more expressive what causes this? Thanks, Trajce Nikolov NICK wrote: > Hi Ali, > > have a look at the osghud example from the osg repo > > > On Fri, Mar 2, 2018 at 1:44 PM, Ali Ozdin < ()> wrote: > > > Hi, > > > > 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. > > > > If I change the line from > > > > Code: > > viewer.setSceneData( mainGroup ); > > > > to > > Code: > > viewer.setSceneData( nn.get() ); > > > > > > and remove these two lines > > > > Code: > > manipulator = new EarthManipulator( arguments ); > > viewer.setCameraManipulator( manipulator ); > > > > > > > > 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. > > 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. > > > > > > > > > > Code: > > osg::ref_ptr createSceneGraph() > > { > > osg::ref_ptr geom = new osg::Geometry; > > osg::ref_ptr v = new osg::Vec3Array; > > geom->setVertexArray( v.get() ); > > > > //horizontal > > v->push_back( osg::Vec3( -1.f, 1.f, 0.f ) ); > > v->push_back( osg::Vec3( -0.6f, 1.f, 0.f ) ); > > v->push_back( osg::Vec3( -0.4f, 1.f, 0.f ) ); > > v->push_back( osg::Vec3( 0.f, 1.f, 0.f ) ); > > > > //vertical > > v->push_back( osg::Vec3( -0.5f, 1.f, 0.5f ) ); > > v->push_back( osg::Vec3( -0.5f, 1.f, 0.1f ) ); > > v->push_back( osg::Vec3( -0.5f, 1.f, -0.5f ) ); > > v->push_back( osg::Vec3( -0.5f, 1.f, -0.1f ) ); > > > > > > osg::ref_ptr c = new osg::Vec4Array; > > geom->setColorArray( c.get() ); > > geom->setColorBinding( osg::Geometry::BIND_OVERALL ); > > c->push_back( osg::Vec4( 1.f, 1.f, 1.f, 1.f ) ); > > > > osg::ref_ptr n = new osg::Vec3Array; > > geom->setNormalArray( n.get() ); > > geom->setNormalBinding( osg::Geometry::BIND_OVERALL ); > > n->push_back( osg::Vec3( 0.f, -1.f, 0.f ) ); > > > > osg::LineWidth* linewdth = new osg::LineWidth(); > > linewdth->setWidth(25.0); > > geom->getOrCreateStateSet()->setAttributeAndModes( linewdth, > > osg::StateAttribute::ON ) ; > > geom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 8 > > ) ); > > > > osg::ref_ptr geode = new osg::Geode; > > geode->addDrawable( geom.get() ); > > return geode.get(); > > } > > > > int main(int argc, char** argv) > > { > > osg::ArgumentParser arguments(,argv); > > viewer.setUpViewInWindow(100,100,500,500); > > viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, false ); > > osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper("osg::Image"); > > manipulator = new EarthManipulator( arguments ); > > viewer.setCameraManipulator( manipulator ); > > > > osg::Group* mainGroup = new osg::Group(); > > osg::Group* group = MapNodeHelper().load(arguments, ); > > osg::ref_ptr nn = createSceneGraph(); > > > > mainGroup->addChild(nn.get()); > > mainGroup->addChild(group); > > > > viewer.setSceneData( mainGroup ); > > viewer.run(); > > } > > > > > > > > Thank you! > > > > Cheers, > > Ali > > > > -- > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=72998#72998 > > (http://forum.openscenegraph.org/viewtopic.php?p=72998#72998) > > > > > > > > > > > > ___ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > -- > trajce nikolov nick > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=73000#73000 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Node can not be displayed front of the Earth on the screen
Hi Ali, have a look at the osghud example from the osg repo On Fri, Mar 2, 2018 at 1:44 PM, Ali Ozdinwrote: > Hi, > > 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. > > If I change the line from > > Code: > viewer.setSceneData( mainGroup ); > > to > Code: > viewer.setSceneData( nn.get() ); > > > and remove these two lines > > Code: > manipulator = new EarthManipulator( arguments ); > viewer.setCameraManipulator( manipulator ); > > > > 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. > 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. > > > > > Code: > osg::ref_ptr createSceneGraph() > { > osg::ref_ptr geom = new osg::Geometry; > osg::ref_ptr v = new osg::Vec3Array; > geom->setVertexArray( v.get() ); > > //horizontal > v->push_back( osg::Vec3( -1.f, 1.f, 0.f ) ); > v->push_back( osg::Vec3( -0.6f, 1.f, 0.f ) ); > v->push_back( osg::Vec3( -0.4f, 1.f, 0.f ) ); > v->push_back( osg::Vec3( 0.f, 1.f, 0.f ) ); > > //vertical > v->push_back( osg::Vec3( -0.5f, 1.f, 0.5f ) ); > v->push_back( osg::Vec3( -0.5f, 1.f, 0.1f ) ); > v->push_back( osg::Vec3( -0.5f, 1.f, -0.5f ) ); > v->push_back( osg::Vec3( -0.5f, 1.f, -0.1f ) ); > > > osg::ref_ptr c = new osg::Vec4Array; > geom->setColorArray( c.get() ); > geom->setColorBinding( osg::Geometry::BIND_OVERALL ); > c->push_back( osg::Vec4( 1.f, 1.f, 1.f, 1.f ) ); > > osg::ref_ptr n = new osg::Vec3Array; > geom->setNormalArray( n.get() ); > geom->setNormalBinding( osg::Geometry::BIND_OVERALL ); > n->push_back( osg::Vec3( 0.f, -1.f, 0.f ) ); > > osg::LineWidth* linewdth = new osg::LineWidth(); > linewdth->setWidth(25.0); > geom->getOrCreateStateSet()->setAttributeAndModes( linewdth, > osg::StateAttribute::ON ) ; > geom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 8 > ) ); > > osg::ref_ptr geode = new osg::Geode; > geode->addDrawable( geom.get() ); > return geode.get(); > } > > int main(int argc, char** argv) > { > osg::ArgumentParser arguments(,argv); > viewer.setUpViewInWindow(100,100,500,500); > viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, false > ); > osgDB::Registry::instance()->getObjectWrapperManager()-> > findWrapper("osg::Image"); > manipulator = new EarthManipulator( arguments ); > viewer.setCameraManipulator( manipulator ); > > osg::Group* mainGroup = new osg::Group(); > osg::Group* group = MapNodeHelper().load(arguments, ); > osg::ref_ptr nn = createSceneGraph(); > > mainGroup->addChild(nn.get()); > mainGroup->addChild(group); > > viewer.setSceneData( mainGroup ); > viewer.run(); > } > > > > Thank you! > > Cheers, > Ali > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=72998#72998 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::Node can not be displayed front of the Earth on the screen
Hi, 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. If I change the line from Code: viewer.setSceneData( mainGroup ); to Code: viewer.setSceneData( nn.get() ); and remove these two lines Code: manipulator = new EarthManipulator( arguments ); viewer.setCameraManipulator( manipulator ); 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. 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. Code: osg::ref_ptr createSceneGraph() { osg::ref_ptr geom = new osg::Geometry; osg::ref_ptr v = new osg::Vec3Array; geom->setVertexArray( v.get() ); //horizontal v->push_back( osg::Vec3( -1.f, 1.f, 0.f ) ); v->push_back( osg::Vec3( -0.6f, 1.f, 0.f ) ); v->push_back( osg::Vec3( -0.4f, 1.f, 0.f ) ); v->push_back( osg::Vec3( 0.f, 1.f, 0.f ) ); //vertical v->push_back( osg::Vec3( -0.5f, 1.f, 0.5f ) ); v->push_back( osg::Vec3( -0.5f, 1.f, 0.1f ) ); v->push_back( osg::Vec3( -0.5f, 1.f, -0.5f ) ); v->push_back( osg::Vec3( -0.5f, 1.f, -0.1f ) ); osg::ref_ptr c = new osg::Vec4Array; geom->setColorArray( c.get() ); geom->setColorBinding( osg::Geometry::BIND_OVERALL ); c->push_back( osg::Vec4( 1.f, 1.f, 1.f, 1.f ) ); osg::ref_ptr n = new osg::Vec3Array; geom->setNormalArray( n.get() ); geom->setNormalBinding( osg::Geometry::BIND_OVERALL ); n->push_back( osg::Vec3( 0.f, -1.f, 0.f ) ); osg::LineWidth* linewdth = new osg::LineWidth(); linewdth->setWidth(25.0); geom->getOrCreateStateSet()->setAttributeAndModes( linewdth, osg::StateAttribute::ON ) ; geom->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 8 ) ); osg::ref_ptr geode = new osg::Geode; geode->addDrawable( geom.get() ); return geode.get(); } int main(int argc, char** argv) { osg::ArgumentParser arguments(,argv); viewer.setUpViewInWindow(100,100,500,500); viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy( true, false ); osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper("osg::Image"); manipulator = new EarthManipulator( arguments ); viewer.setCameraManipulator( manipulator ); osg::Group* mainGroup = new osg::Group(); osg::Group* group = MapNodeHelper().load(arguments, ); osg::ref_ptr nn = createSceneGraph(); mainGroup->addChild(nn.get()); mainGroup->addChild(group); viewer.setSceneData( mainGroup ); viewer.run(); } Thank you! Cheers, Ali -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72998#72998 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Geode is not seen when added as child on osgEarth
Any idea? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72997#72997 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] set cullface mode in osg file
Hi Sebastian, Geode {... Geometry { ... StateSet { ... GL_CULL_FACE ON Material { } CullFace { mode BACK } For no culling use GL_CULL_FACE OVERRIDE|OFF To cull front faces use mode FRONT. To cull all faces use mode FRONT_AND_BACK Regards, Laurens. On Fri, Mar 2, 2018 at 11:07 AM, Sebastian Schmidtwrote: > Hi, > > What is the correct syntax to enable front or backface culling in an osg > file? > > For example: > > Geode {... > Geometry { ... > StateSet { ... > GL_CULL_FACE ON > ... > Material { > > > OSG Version: 3.4.1 > OS: OpenSuse Leap 42.1 > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=72995#72995 > > > > > > ___ > 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
[osg-users] set cullface mode in osg file
Hi, What is the correct syntax to enable front or backface culling in an osg file? For example: Geode {... Geometry { ... StateSet { ... GL_CULL_FACE ON ... Material { OSG Version: 3.4.1 OS: OpenSuse Leap 42.1 -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=72995#72995 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org