Re: [osg-users] osg::Vec3Array as uniform to Shader

2018-03-05 Thread Rômulo Cerqueira
Thanks, Robert.
... 

Thank you!

Cheers,
Rômulo

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





___
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

2018-03-05 Thread Ali Ozdin
Thank you very much, I did it. 


Trajce Nikolov NICK wrote:
> 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 Ozdin < ()> wrote:
> 
> > 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) 
> > > > (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)
> > > >  
> > > > 

Re: [osg-users] Database pager and failed loading of PagedLOD's children

2018-03-05 Thread Robert Osfield
HI Hatwig,

On 4 March 2018 at 21:02, Hartwig Wiesmann  wrote:
> the problem seems to be that the database pager (respectively the paged LOD) 
> keeps trying to load the node that fails to load. To stop this I somehow have 
> to tell the paged LOD to stop loading the children, or I have to modify the 
> limits. But for doing so I need to know when a child fails to load.

This repeating of requests is part of the design of
PagedLOD/DatabasePager, the pager gets requested each time a LOD level
is selected as required by the cull traversal isn't available.  This
request happens every frame till that LOD level is loaded or isn't
required anymore. The later part is the key to why the mechanism is
used, the pager prunes requests that are no longer being requested so
that areas that you move out of view don't get paged in as they aren't
needed anymore.  This mechanism is crucial part of achieving the
lowest latency on loading tiles that are required for the view on
screen.  The faster moving the view is the more important it becomes -
think flight simulators etc.

For you usage case it sounds like your database isn't complete for
some reason, the current design+implementation doesn't have any
fallback mechanism for incomplete paged databases.  Nothing untoward
should happen in this case, all will happen is that the paging thread
will spend a bit of time trying and failing, so it'll lower
performance a bit but that's it. If the database is fixed while the
application is running - for instance a lost http connection is
re-established then finally the tiles can be loaded, so this scheme
will isn't 100% efficient in the failure case it does add resilience.

If it really is the case that a file request failure is permanent for
the life of the application then what you'd ideally want to do is have
the missing child entry into PageLOD be filled in be the child before
it.  This would then kill off any future requests for the missing
child.  Save for modifying the core OSG (PagedLOD/DatabasePager) to
add support this particular behaviour it wouldn't be straight forward,
but there is chance you might be able to use a combination of a
osgDB::Option object with a ReadFileCallback assigned to it such that
it uses the existing PagedLOD children as fallback.

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