[osg-users] wireframe darker wrt the surface color

2017-03-21 Thread Gianni Ambrosio
Hi All,
I implemented the wireframe feature as follows:


Code:
void addWireframe(osg::Group* root, osg::Node* scene)
{
   osg::ref_ptr decorator = new osg::Group;
   decorator->setNodeMask(0x1);

   osg::StateSet* stateset = decorator->getOrCreateStateSet();

   osg::PolygonOffset* polyoffset = new osg::PolygonOffset;
   polyoffset->setFactor(2.0f);
   polyoffset->setUnits(2.0f);
   stateset->setAttributeAndModes(polyoffset, osg::StateAttribute::OVERRIDE | 
osg::StateAttribute::ON);

   osg::PolygonMode* polymode = new osg::PolygonMode;
   polymode->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);
   stateset->setAttributeAndModes(polymode, osg::StateAttribute::OVERRIDE | 
osg::StateAttribute::ON);

   osg::Material* material = new osg::Material;
   material->setColorMode(osg::Material::OFF); // switch glColor usage off
   // turn all lighting off
   material->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(0.5, 0.5f, 
0.5f, 1.0f));
   material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(0.5, 0.5f, 
0.5f, 1.0f));
   material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(0.0, 0.0f, 
0.0f, 1.0f));
   // except emission... in which we set the color we desire
   material->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4(0.7, 0.7f, 
0.7f, 1.0f));
   stateset->setAttributeAndModes(material, osg::StateAttribute::OVERRIDE | 
osg::StateAttribute::ON);
   stateset->setMode(GL_LIGHTING, osg::StateAttribute::OVERRIDE | 
osg::StateAttribute::ON);

   decorator->addChild(scene);
   root->addChild(decorator);
}



Now instead of having the wireframe of a fixed color, I would like to show it 
in a slightly darker color wrt the color of the related geometry. Is it 
possible? How?

Thanks in advance,
Gianni

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





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


Re: [osg-users] Bug in 3.4.0 when exporting .osgx file?

2017-03-21 Thread Robert Osfield
Hi Werner,

As I explained in my previous post, the method should find the
wrappers if the plugin has been already loaded, so it shouldn't be
trying to reload a plugin as there would be no beneft - the code will
have already checked all the possible wrappers.

You haven't provided any guidance on how we might reproduce the issue
so I can't say what might be wrong.  The code you are looking at is
likely of symptom of a problem elsewhere.

Another avenue you could try is to look at the OSG master to see if
fixes elsewhere in the OSG have addressed this issue.

Robert.

On 21 March 2017 at 14:54, Werner Modenbach  wrote:
> Hi Robert,
>
> the problem is here:
>
> if
> (osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED)
>
> return findWrapper(name);
>
> return NULL;
>
> The loadLibrary() returns PREVIOUSLY_LOADED and not LOADED.
> So NULL gets returned instead of a wrapper pointer and thus the node doesn't
> get exported.
> Or am I on the wrong search path?
>
> I try exporting my scene into an .osgx file by calling:
> osg::ref_ptr rw =
> osgDB::Registry::instance()->getReaderWriterForExtension(
>
> osgDB::getLowerCaseFileExtension(_filename.toStdString()));
> if (!rw.valid())
> return false;
> osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
> _filename.toStdString());
>
> result.success() is true.
> It creates a file containing only the outer xml header and no scene data.
> node is of type osg::group
>
>
> Am 21.03.2017 um 14:42 schrieb Robert Osfield:
>
> Hi Werner,
>
> I can't work out what might be wrong form the description.
>
> In general the ObjectWrapperManager::findWrapper() checks wrappers
> that have been registered with it first, then if it fails to find one
> then attempts to load plugins that may be able to provide that
> wrapper. If the code is getting to the find return then it's an
> indication that the wrapper has been found.  Given this the
> ObjectWrapperManager::findWrapper() code looks correct.
>
> This review would suggest that the issue is likely elsewhere.  What
> might be wrong is not something I can say at this stage.  Would it be
> possible create a test case that reproduces the problem so others can
> look into it?
>
> Robert.
>
>
> On 21 March 2017 at 13:15, Werner Modenbach 
> wrote:
>
> Hi Robert,
>
> I think I catched another problem in version 3.4.0.
> I try exporting my scene as .osgx file.
> But except the xml header nothing is written.
> I debuged it and found the following sequence of calls:
>
>
> osg::ref_ptr rw =
> osgDB::Registry::instance()->getReaderWriterForExtension(
>
>
> osgDB::getLowerCaseFileExtension(_filename.toStdString()));
>
> if (!rw.valid())
>
> return false;
>
> osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
> _filename.toStdString());
>
> -> ReaderWriterOSG2::writeNode(...)
>
> result = writeNode( node, fout, local_opt.get() );
>
> -> ReaderWriterOSG2::writeNode(...)
>
> os.writeObject(  ); CATCH_EXCEPTION(os);
>
> -> OutputStream::writeObject(...)
>
> if (newID)
> {
> writeObjectFields(obj);
> }
>
> -> OutputStream::writeObjectFields(...)
>
> ObjectWrapper* wrapper =
> Registry::instance()->getObjectWrapperManager()->findWrapper( name );
> if ( !wrapper )
> {
> OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
> "
> << name << std::endl;
> return;
> }
>
> -> OutputStream::writeObjectFields(...)
>
> ObjectWrapper* wrapper =
> Registry::instance()->getObjectWrapperManager()->findWrapper( name );
> if ( !wrapper )
> {
> OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
> "
> << name << std::endl;
> return;
> }
> -> ObjectWrapperManager::findWrapper(...)
>
> pluginLib =
> osgDB::Registry::instance()->createLibraryNameForExtension(libName);
> if (
> osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED
> )
> return findWrapper(name);
> }
> return NULL;
>
> The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is
> returned and nothing gets written.
>
> I think that should be different. Am I right?
>
> - Werner -
>
>
>
> ___
> 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
>
>
> --
> TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
> Phone: +49 241 475757-0
> Fax: +49 241 475757-29
> Web: http://texion.eu
> eMail: i...@texion.eu
>
> ___
> osg-users mailing list
> 

Re: [osg-users] Bug in 3.4.0 when exporting .osgx file?

2017-03-21 Thread Werner Modenbach

Hi Robert,

the problem is here:

if 
(osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED)

return findWrapper(name);

return NULL;

The loadLibrary() returns PREVIOUSLY_LOADED and not LOADED.
So NULL gets returned instead of a wrapper pointer and thus the node doesn't 
get exported.
Or am I on the wrong search path?

I try exporting my scene into an .osgx file by calling:
osg::ref_ptrrw=osgDB::Registry::instance()->getReaderWriterForExtension( 
osgDB::getLowerCaseFileExtension(_filename.toStdString())); 
if(!rw.valid()) returnfalse; osgDB::ReaderWriter::WriteResultresult=rw->writeNode(_node,_filename.toStdString());


result.success() is true.
It creates a file containing only the outer xml header and no scene data. node 
is of type osg::group


Am 21.03.2017 um 14:42 schrieb Robert Osfield:

Hi Werner,

I can't work out what might be wrong form the description.

In general the ObjectWrapperManager::findWrapper() checks wrappers
that have been registered with it first, then if it fails to find one
then attempts to load plugins that may be able to provide that
wrapper. If the code is getting to the find return then it's an
indication that the wrapper has been found.  Given this the
ObjectWrapperManager::findWrapper() code looks correct.

This review would suggest that the issue is likely elsewhere.  What
might be wrong is not something I can say at this stage.  Would it be
possible create a test case that reproduces the problem so others can
look into it?

Robert.


On 21 March 2017 at 13:15, Werner Modenbach  wrote:

Hi Robert,

I think I catched another problem in version 3.4.0.
I try exporting my scene as .osgx file.
But except the xml header nothing is written.
I debuged it and found the following sequence of calls:


 osg::ref_ptr rw =
osgDB::Registry::instance()->getReaderWriterForExtension(


osgDB::getLowerCaseFileExtension(_filename.toStdString()));

 if (!rw.valid())

 return false;

 osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
_filename.toStdString());

-> ReaderWriterOSG2::writeNode(...)

 result = writeNode( node, fout, local_opt.get() );

-> ReaderWriterOSG2::writeNode(...)

 os.writeObject(  ); CATCH_EXCEPTION(os);

-> OutputStream::writeObject(...)

 if (newID)
 {
 writeObjectFields(obj);
 }

-> OutputStream::writeObjectFields(...)

 ObjectWrapper* wrapper =
Registry::instance()->getObjectWrapperManager()->findWrapper( name );
 if ( !wrapper )
 {
 OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
"
 << name << std::endl;
 return;
 }

-> OutputStream::writeObjectFields(...)

 ObjectWrapper* wrapper =
Registry::instance()->getObjectWrapperManager()->findWrapper( name );
 if ( !wrapper )
 {
 OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
"
 << name << std::endl;
 return;
 }
-> ObjectWrapperManager::findWrapper(...)

 pluginLib =
osgDB::Registry::instance()->createLibraryNameForExtension(libName);
 if (
osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED
)
 return findWrapper(name);
 }
 return NULL;

The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is
returned and nothing gets written.

I think that should be different. Am I right?

- Werner -



___
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


--
*TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Bug in 3.4.0 when exporting .osgx file?

2017-03-21 Thread Robert Osfield
Hi Werner,

I can't work out what might be wrong form the description.

In general the ObjectWrapperManager::findWrapper() checks wrappers
that have been registered with it first, then if it fails to find one
then attempts to load plugins that may be able to provide that
wrapper. If the code is getting to the find return then it's an
indication that the wrapper has been found.  Given this the
ObjectWrapperManager::findWrapper() code looks correct.

This review would suggest that the issue is likely elsewhere.  What
might be wrong is not something I can say at this stage.  Would it be
possible create a test case that reproduces the problem so others can
look into it?

Robert.


On 21 March 2017 at 13:15, Werner Modenbach  wrote:
> Hi Robert,
>
> I think I catched another problem in version 3.4.0.
> I try exporting my scene as .osgx file.
> But except the xml header nothing is written.
> I debuged it and found the following sequence of calls:
>
>
> osg::ref_ptr rw =
> osgDB::Registry::instance()->getReaderWriterForExtension(
>
>
> osgDB::getLowerCaseFileExtension(_filename.toStdString()));
>
> if (!rw.valid())
>
> return false;
>
> osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
> _filename.toStdString());
>
> -> ReaderWriterOSG2::writeNode(...)
>
> result = writeNode( node, fout, local_opt.get() );
>
> -> ReaderWriterOSG2::writeNode(...)
>
> os.writeObject(  ); CATCH_EXCEPTION(os);
>
> -> OutputStream::writeObject(...)
>
> if (newID)
> {
> writeObjectFields(obj);
> }
>
> -> OutputStream::writeObjectFields(...)
>
> ObjectWrapper* wrapper =
> Registry::instance()->getObjectWrapperManager()->findWrapper( name );
> if ( !wrapper )
> {
> OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
> "
> << name << std::endl;
> return;
> }
>
> -> OutputStream::writeObjectFields(...)
>
> ObjectWrapper* wrapper =
> Registry::instance()->getObjectWrapperManager()->findWrapper( name );
> if ( !wrapper )
> {
> OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
> "
> << name << std::endl;
> return;
> }
> -> ObjectWrapperManager::findWrapper(...)
>
> pluginLib =
> osgDB::Registry::instance()->createLibraryNameForExtension(libName);
> if (
> osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED
> )
> return findWrapper(name);
> }
> return NULL;
>
> The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is
> returned and nothing gets written.
>
> I think that should be different. Am I right?
>
> - Werner -
>
>
>
> ___
> 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] Bug in 3.4.0 when exporting .osgx file?

2017-03-21 Thread Werner Modenbach

Hi Robert,

I think I catched another problem in version 3.4.0.
I try exporting my scene as .osgx file.
But except the xml header nothing is written.
I debuged it and found the following sequence of calls:


osg::ref_ptrrw=osgDB::Registry::instance()->getReaderWriterForExtension( 



osgDB::getLowerCaseFileExtension(_filename.toStdString()));

if(!rw.valid())

returnfalse;

osgDB::ReaderWriter::WriteResultresult=rw->writeNode(_node,_filename.toStdString());

-> ReaderWriterOSG2::writeNode(...)
result=writeNode(node,fout,local_opt.get());

-> ReaderWriterOSG2::writeNode(...) os.writeObject();CATCH_EXCEPTION(os);

->OutputStream::writeObject(...)

if(newID)
{
writeObjectFields(obj);
}

->OutputStream::writeObjectFields(...)

ObjectWrapper*wrapper=Registry::instance()->getObjectWrapperManager()->findWrapper(name);
if(!wrapper)
{
OSG_WARN<<"OutputStream::writeObject():Unsupportedwrapperclass"
<OutputStream::writeObjectFields(...)

ObjectWrapper*wrapper=Registry::instance()->getObjectWrapperManager()->findWrapper(name);
if(!wrapper)
{
OSG_WARN<<"OutputStream::writeObject():Unsupportedwrapperclass"
<ObjectWrapperManager::findWrapper(...)

pluginLib=osgDB::Registry::instance()->createLibraryNameForExtension(libName);
if(osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED)
returnfindWrapper(name);
}
returnNULL;

The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is returned 
and nothing gets written.

I think that should be different. Am I right?

- Werner -


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


[osg-users] [vpb] Roads

2017-03-21 Thread Bhanu Chandra
Hi,
I got highway tag from the QGIS(OpenStreetMap) for roads and integrated with 
DEM file using VPB with following command.
osgdemd -t texture/image.tif -d elevation/dem.tif --forest highway/roads.shp 
--height 10 --TERRAIN -o output/output.osg
After that i am getting the vertices of roads from output.osg and drawing the 
lines above the terrain. But some places lines are going  under the terrain 
because of different heights of terrain. For this i tried with HUD camera by 
setting POST_RENDER. So, i am able to see the lines even if lines are under 
terrain.But this is not correct method. Is there any ways to solve this problem?
... 


Thank you!

Cheers,
Bhanu

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





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