Re: [osg-users] Error when using osgShadow

2015-06-29 Thread david boublil
Hi Robert,

thanks for your answer! 
What do you mean by tracking with a debugger? I attached to my previous message 
the output obtained with in the osg debug mode... 
Concerning the other info, I am running my code on linux, with 2.8.1 osg 
version. 
The code I attached is working if I am removing the ShadowMap technique and is 
showing the scene without shadow. 
I also tried to replace ShadowMap by other technique but: whether it's running 
without showing any shadow (for example using ShadowTexture,ShadowTexture 
techniques) or it's just not working (SoftShadowMap, ParallelSplitShadowMap) 
and the same floating point exception error is obtained.

Thank you in advance!

Cheers,
david

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





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


Re: [osg-users] Error when using osgShadow

2015-06-29 Thread Sebastian Messerschmidt

Hi David,

Usually there is not much value in a floating point exception. I guess 
there is an NaN or division by zero, which I observed for empty or 
degenerate scene bounds.
I advise to compile with floating point exceptions disabled, as osg will 
print out errors to the console in those cases anyways (check your 
compiler flags) and osg is not using structured exceptions ...
If you are using Visual Studio you can enable catching exceptions from 
the debugger to see where they are thrown and can provide a call stack, 
so I guess something like this is possible with gdb too.


Also: are the osgshadow examples working?
Cheers
Sebastian

Hi Robert,

thanks for your answer!
What do you mean by tracking with a debugger? I attached to my previous message 
the output obtained with in the osg debug mode...
Concerning the other info, I am running my code on linux, with 2.8.1 osg 
version.
The code I attached is working if I am removing the ShadowMap technique and is 
showing the scene without shadow.
I also tried to replace ShadowMap by other technique but: whether it's running without 
showing any shadow (for example using ShadowTexture,ShadowTexture techniques) or it's 
just not working (SoftShadowMap, ParallelSplitShadowMap) and the same floating 
point exception error is obtained.

Thank you in advance!

Cheers,
david

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





___
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] Error when using osgShadow

2015-06-29 Thread Robert Osfield
Hi David,

A floating point exception is something you'll need to track down with a
debugger as it's not something that usually could be tracked down with a
code review.

One you have a stack trace and share this then perhaps others might be able
to help.  Other information that would help would be the platform you are
using, OSG version. whether standard OSG examples like osgshadow work OK
etc.

Robert.

On 29 June 2015 at 12:42, david boublil davb...@gmail.com wrote:

 Hi,

 I am trying to run a simple code that I got from tutorial which is
 supposed to add shadows to the scene but I am getting a floating point
 exception error. I have no idea how I can solve it, I would really
 appreciated some help...

 Here is the source code:

 using namespace osg;
 int main()
 {

 //Declaration of the objects that will form our scene
 osgViewer::Viewer viewer;
 ref_ptrGroup scene (new Group);
 ref_ptrGeode objectGeode (new Geode);
 ref_ptrGeode terrainGeode (new Geode);
 ref_ptrGeode lightMarkerGeode (new Geode);

 //Shadow stuff!!

 ref_ptrosgShadow::ShadowedScene shadowedScene = new
 osgShadow::ShadowedScene;
 ref_ptrosgShadow::ShadowMap sm = new osgShadow::ShadowMap;
 shadowedScene-setShadowTechnique(sm.get());
 //Main light source
 Vec3 lightPosition(0,0,3);
 LightSource* ls = new LightSource;
 ls-getLight()-setPosition(Vec4(lightPosition,1));
 ls-getLight()-setAmbient(Vec4(0.2,0.2,0.2,1.0));
 ls-getLight()-setDiffuse(Vec4(0.6,0.6,0.6,1.0));

 shadowedScene-addChild(scene.get());
 shadowedScene-addChild(ls);
 shadowedScene-addChild(lightMarkerGeode.get());

 //Next we define the material property of our objects
 // material
 ref_ptrMaterial matirial = new Material;
 matirial-setColorMode(Material::DIFFUSE);
 matirial-setAmbient(Material::FRONT_AND_BACK, Vec4(0, 0, 0, 1));
 matirial-setSpecular(Material::FRONT_AND_BACK, Vec4(1, 1, 1, 1));
 matirial-setShininess(Material::FRONT_AND_BACK, 64);
 scene-getOrCreateStateSet()-setAttributeAndModes(matirial.get(),
 StateAttribute::ON);


 //Adding the terrain and object nodes to the root node
 scene-addChild(objectGeode.get());
 scene-addChild(terrainGeode.get());

 //The terrain first, a flatten box
 terrainGeode-addDrawable(new ShapeDrawable(new
 Box(Vec3f(),5,7,0.05f)));

 //Now we can define our world made of several objects
 //The capsule
 objectGeode-addDrawable(new ShapeDrawable(new
 Capsule(Vec3(1,-1,1),0.3f,0.5f)));

 //The box
 objectGeode-addDrawable(new ShapeDrawable(new
 Box(Vec3(-1,1,1),1,1,1)));

 //The sphere
 objectGeode-addDrawable(new ShapeDrawable(new
 Sphere(Vec3(1,2,1),0.5f)));
 //objectGeode-addDrawable(new ShapeDrawable(new
 Sphere(Vec3(0,0,4.5f),0.1f)));

 //And finally the light marker: a small sphere
 lightMarkerGeode-addDrawable(new ShapeDrawable(new
 Sphere(lightPosition+osg::Vec3(0,0,0.5f),0.1f)));
 viewer.setSceneData( shadowedScene.get() );

 //Stats Event Handler s key
 viewer.addEventHandler(new osgViewer::StatsHandler);

 // add the state manipulator
 viewer.addEventHandler( new
 osgGA::StateSetManipulator(viewer.getCamera()-getOrCreateStateSet()) );

 //Windows size handler
 viewer.addEventHandler(new osgViewer::WindowSizeHandler);

return(viewer .run());

 }

 I used the debug mode and got the following output:

 RegisterWindowingSystemInterfaceProxy()
 X11WindowingSystemInterface()
 GraphicsContext::setWindowingSystemInterface() 0x2030620
 0x7fdb2a28a5f0
 CullSettings::readEnvironmentalVariables()
 DatabasePager::addDatabaseThread() HANDLE_NON_HTTP
 DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP
 CullSettings::readEnvironmentalVariables()
 CullSettings::readEnvironmentalVariables()
 CullSettings::readEnvironmentalVariables()
 CullSettings::readEnvironmentalVariables()
 CullSettings::readEnvironmentalVariables()
 itr='/opt/matlab/sys/openscenegraph/lib/glnxa64'
 FindFileInPath() : trying
 /opt/matlab/sys/openscenegraph/lib/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so
 ...
 itr='/opt/matlab/sys/os/glnxa64'
 FindFileInPath() : trying
 /opt/matlab/sys/os/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
 itr='/opt/matlab/bin/glnxa64'
 FindFileInPath() : trying
 /opt/matlab/bin/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
 itr='/opt/matlab/extern/lib/glnxa64'
 FindFileInPath() : trying
 /opt/matlab/extern/lib/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
 itr='/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads'
 FindFileInPath() : trying
 /opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads/osgPlugins-2.8.1/osgdb_jpeg.so
 ...
 itr='/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/server'
 FindFileInPath() : trying
 

Re: [osg-users] Error when using osgShadow

2015-06-29 Thread Robert Osfield
Hi David,

On 29 June 2015 at 14:19, david boublil davb...@gmail.com wrote:

 What do you mean by tracking with a debugger?


A debugger as in gdb, VisualStudio etc.



 I attached to my previous message the output obtained with in the osg
 debug mode...
 Concerning the other info, I am running my code on linux, with 2.8.1 osg
 version.


You could just try updating to a more up to date version of the OSG, 2.8.1
is pretty ancient.  OSG-3.2.x is a better bet alround.  I have no clue
whether it will have any baring on the floating point error.


 The code I attached is working if I am removing the ShadowMap technique
 and is showing the scene without shadow.
 I also tried to replace ShadowMap by other technique but: whether it's
 running without showing any shadow (for example using
 ShadowTexture,ShadowTexture techniques) or it's just not working
 (SoftShadowMap, ParallelSplitShadowMap) and the same floating point
 exception error is obtained.


Again.  A stack trace is required.

Also info on hardware + GL drive would be useful as it could well be a
driver bug.

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


Re: [osg-users] Error when using osgShadow

2015-06-29 Thread david boublil
Hi,

I am trying to run a simple code that I got from tutorial which is supposed to 
add shadows to the scene but I am getting a floating point exception error. I 
have no idea how I can solve it, I would really appreciated some help... 

Here is the source code:

using namespace osg;
int main()
{

//Declaration of the objects that will form our scene
osgViewer::Viewer viewer;
ref_ptrGroup scene (new Group);
ref_ptrGeode objectGeode (new Geode);
ref_ptrGeode terrainGeode (new Geode);
ref_ptrGeode lightMarkerGeode (new Geode);

//Shadow stuff!!

ref_ptrosgShadow::ShadowedScene shadowedScene = new 
osgShadow::ShadowedScene;
ref_ptrosgShadow::ShadowMap sm = new osgShadow::ShadowMap;
shadowedScene-setShadowTechnique(sm.get());
//Main light source 
Vec3 lightPosition(0,0,3); 
LightSource* ls = new LightSource;
ls-getLight()-setPosition(Vec4(lightPosition,1));
ls-getLight()-setAmbient(Vec4(0.2,0.2,0.2,1.0));
ls-getLight()-setDiffuse(Vec4(0.6,0.6,0.6,1.0));

shadowedScene-addChild(scene.get());
shadowedScene-addChild(ls);
shadowedScene-addChild(lightMarkerGeode.get());

//Next we define the material property of our objects 
// material
ref_ptrMaterial matirial = new Material;
matirial-setColorMode(Material::DIFFUSE);
matirial-setAmbient(Material::FRONT_AND_BACK, Vec4(0, 0, 0, 1));
matirial-setSpecular(Material::FRONT_AND_BACK, Vec4(1, 1, 1, 1));
matirial-setShininess(Material::FRONT_AND_BACK, 64);
scene-getOrCreateStateSet()-setAttributeAndModes(matirial.get(), 
StateAttribute::ON);


//Adding the terrain and object nodes to the root node
scene-addChild(objectGeode.get());
scene-addChild(terrainGeode.get());

//The terrain first, a flatten box
terrainGeode-addDrawable(new ShapeDrawable(new 
Box(Vec3f(),5,7,0.05f)));

//Now we can define our world made of several objects   
//The capsule
objectGeode-addDrawable(new ShapeDrawable(new 
Capsule(Vec3(1,-1,1),0.3f,0.5f)));

//The box
objectGeode-addDrawable(new ShapeDrawable(new 
Box(Vec3(-1,1,1),1,1,1)));

//The sphere
objectGeode-addDrawable(new ShapeDrawable(new 
Sphere(Vec3(1,2,1),0.5f)));
//objectGeode-addDrawable(new ShapeDrawable(new 
Sphere(Vec3(0,0,4.5f),0.1f)));

//And finally the light marker: a small sphere
lightMarkerGeode-addDrawable(new ShapeDrawable(new 
Sphere(lightPosition+osg::Vec3(0,0,0.5f),0.1f)));
viewer.setSceneData( shadowedScene.get() );

//Stats Event Handler s key
viewer.addEventHandler(new osgViewer::StatsHandler);

// add the state manipulator
viewer.addEventHandler( new 
osgGA::StateSetManipulator(viewer.getCamera()-getOrCreateStateSet()) );

//Windows size handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);   

   return(viewer .run());

}

I used the debug mode and got the following output:

RegisterWindowingSystemInterfaceProxy()
X11WindowingSystemInterface()
GraphicsContext::setWindowingSystemInterface() 0x20306200x7fdb2a28a5f0
CullSettings::readEnvironmentalVariables()
DatabasePager::addDatabaseThread() HANDLE_NON_HTTP
DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
itr='/opt/matlab/sys/openscenegraph/lib/glnxa64'
FindFileInPath() : trying 
/opt/matlab/sys/openscenegraph/lib/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
itr='/opt/matlab/sys/os/glnxa64'
FindFileInPath() : trying 
/opt/matlab/sys/os/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
itr='/opt/matlab/bin/glnxa64'
FindFileInPath() : trying 
/opt/matlab/bin/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
itr='/opt/matlab/extern/lib/glnxa64'
FindFileInPath() : trying 
/opt/matlab/extern/lib/glnxa64/osgPlugins-2.8.1/osgdb_jpeg.so ...
itr='/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads'
FindFileInPath() : trying 
/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads/osgPlugins-2.8.1/osgdb_jpeg.so
 ...
itr='/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/server'
FindFileInPath() : trying 
/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/server/osgPlugins-2.8.1/osgdb_jpeg.so
 ...
itr='/homes/davidb/Downloads/local/Mesa-7.0.3/lib64/'
FindFileInPath() : trying 
/homes/davidb/Downloads/local/Mesa-7.0.3/lib64/osgPlugins-2.8.1/osgdb_jpeg.so 
...
itr='/homes/davidb/Downloads/local/lib64/osgPlugins-2.8.1/'
FindFileInPath() : trying 
/homes/davidb/Downloads/local/lib64/osgPlugins-2.8.1/osgPlugins-2.8.1/osgdb_jpeg.so
 ...
itr='/homes/davidb/Downloads/local/lib64'
FindFileInPath() : trying