OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Error when using osgShadow


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
davboub
Newbie


Joined: 29 Jun 2015
Posts: 2

PostPosted: Mon Jun 29, 2015 11:30 am    Post subject:
Error when using osgShadow
Reply with quote

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_ptr<Group> scene (new Group);
ref_ptr<Geode> objectGeode (new Geode);
ref_ptr<Geode> terrainGeode (new Geode);
ref_ptr<Geode> lightMarkerGeode (new Geode);

//Shadow stuff!!

ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene;
ref_ptr<osgShadow::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_ptr<Material> 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:ShockedN);


//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 /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 /homes/davidb/Downloads/local/lib64/osgPlugins-2.8.1/osgdb_jpeg.so ...
FindFileInPath() : USING /homes/davidb/Downloads/local/lib64/osgPlugins-2.8.1/osgdb_jpeg.so
Opened DynamicLibrary osgPlugins-2.8.1/osgdb_jpeg.so
FindFileInPath(ground.jpg): returning ground.jpg

try to read image
can't read image with osgdb
View::setSceneData() Reusing exisitng scene0x2031480
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
Viewer::realize() - No valid contexts found, setting up view across all screens.
GraphicsContext::getWindowingSystemInterface() 0x2030620 0x7fdb2a28a5f0
GraphicsContext::registerGraphicsContext 0x204b140
GraphicsContext::getWindowingSystemInterface() 0x2030620 0x7fdb2a28a5f0
GraphicsContext::createNewContextID() creating contextID=0
Updating the MaxNumberOfGraphicsContexts to 1
GraphicsWindow has been created successfully.
Viewer::startThreading() - starting threading
Viewer::startThreading() - contexts.size()=1
Making scene thread safe
Doing add
Doing add
Doing add
gc->getGraphicsThread()->startThread() 0x233c5e0
Set up threading
View::init()
FocusOut/UnmapNotify event received
FocusIn event received
KeymapNotify event received
CullSettings::readEnvironmentalVariables()
Done DatabasePager::addLoadedDataToSceneGraph0.001ms, 0ms objects0

Doing run 0x233c5e0 isRunning()=1
OpenGL extensions supported by installed OpenGL drivers are:
GL_APPLE_packed_pixels
GL_APPLE_vertex_array_object
GL_ARB_depth_texture
GL_ARB_draw_buffers
GL_ARB_fragment_program
GL_ARB_fragment_shader
GL_ARB_half_float_pixel
GL_ARB_imaging
GL_ARB_multisample
GL_ARB_multitexture
GL_ARB_occlusion_query
GL_ARB_pixel_buffer_object
GL_ARB_point_parameters
GL_ARB_point_sprite
GL_ARB_shader_objects
GL_ARB_shading_language_100
GL_ARB_shading_language_120
GL_ARB_shadow
GL_ARB_shadow_ambient
GL_ARB_texture_border_clamp
GL_ARB_texture_compression
GL_ARB_texture_cube_map
GL_ARB_texture_env_add
GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar
GL_ARB_texture_env_dot3
GL_ARB_texture_mirrored_repeat
GL_ARB_texture_non_power_of_two
GL_ARB_texture_rectangle
GL_ARB_transpose_matrix
GL_ARB_vertex_buffer_object
GL_ARB_vertex_program
GL_ARB_vertex_shader
GL_ARB_window_pos
GL_ATI_blend_equation_separate
GL_ATI_fragment_shader
GL_ATI_separate_stencil
GL_ATI_texture_env_combine3
GL_ATI_texture_mirror_once
GL_EXT_abgr
GL_EXT_bgra
GL_EXT_blend_color
GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate
GL_EXT_blend_logic_op
GL_EXT_blend_minmax
GL_EXT_blend_subtract
GL_EXT_clip_volume_hint
GL_EXT_compiled_vertex_array
GL_EXT_convolution
GL_EXT_copy_texture
GL_EXT_depth_bounds_test
GL_EXT_draw_range_elements
GL_EXT_fog_coord
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_object
GL_EXT_gpu_program_parameters
GL_EXT_histogram
GL_EXT_multi_draw_arrays
GL_EXT_packed_depth_stencil
GL_EXT_packed_pixels
GL_EXT_paletted_texture
GL_EXT_pixel_buffer_object
GL_EXT_point_parameters
GL_EXT_polygon_offset
GL_EXT_rescale_normal
GL_EXT_secondary_color
GL_EXT_separate_specular_color
GL_EXT_shadow_funcs
GL_EXT_shared_texture_palette
GL_EXT_stencil_wrap
GL_EXT_subtexture
GL_EXT_texture
GL_EXT_texture3D
GL_EXT_texture_edge_clamp
GL_EXT_texture_env_add
GL_EXT_texture_env_combine
GL_EXT_texture_env_dot3
GL_EXT_texture_lod_bias
GL_EXT_texture_mirror_clamp
GL_EXT_texture_object
GL_EXT_texture_rectangle
GL_EXT_texture_sRGB
GL_EXT_timer_query
GL_EXT_vertex_array
GL_IBM_multimode_draw_arrays
GL_IBM_rasterpos_clip
GL_IBM_texture_mirrored_repeat
GL_INGR_blend_func_separate
GL_MESA_pack_invert
GL_MESA_program_debug
GL_MESA_resize_buffers
GL_MESA_window_pos
GL_MESA_ycbcr_texture
GL_NV_blend_square
GL_NV_fragment_program
GL_NV_light_max_exponent
GL_NV_point_sprite
GL_NV_texgen_reflection
GL_NV_texture_rectangle
GL_NV_vertex_program
GL_NV_vertex_program1_1
GL_OES_read_format
GL_SGIS_generate_mipmap
GL_SGIS_texture_border_clamp
GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod
GL_SGIX_depth_texture
GL_SGIX_shadow
GL_SGIX_shadow_ambient
GL_SGI_color_matrix
GL_SGI_color_table
GL_SGI_texture_color_table
GL_SUN_multi_draw_arrays
OpenGL extension 'GL_ARB_vertex_program' is supported.
OpenGL extension 'GL_EXT_secondary_color' is supported.
OpenGL extension 'GL_EXT_fog_coord' is supported.
OpenGL extension 'GL_ARB_multitexture' is supported.
OpenGL extension 'GL_NV_occlusion_query' is not supported.
OpenGL extension 'GL_ARB_occlusion_query' is supported.
OpenGL extension 'GL_EXT_timer_query' is supported.
OpenGL extension '' is not supported.
Done DatabasePager::addLoadedDataToSceneGraph0ms, 0.001ms objects0

OpenGL extension 'GL_ARB_pixel_buffer_object' is supported.
OpenGL extension 'GL_ARB_fragment_program' is supported.
OpenGL extension 'GL_EXT_framebuffer_object' is supported.
OpenGL extension 'GL_EXT_framebuffer_blit' is supported.
OpenGL extension 'GL_EXT_framebuffer_multisample' is not supported.
OpenGL extension 'GL_NV_framebuffer_multisample_coverage' is not supported.
OpenGL extension 'GL_EXT_packed_depth_stencil' is supported.
OpenGL extension 'GL_ARB_shader_objects' is supported.
OpenGL extension 'GL_ARB_vertex_shader' is supported.
OpenGL extension 'GL_ARB_fragment_shader' is supported.
OpenGL extension 'GL_ARB_shading_language_100' is supported.
OpenGL extension 'GL_EXT_geometry_shader4' is not supported.
OpenGL extension 'GL_EXT_gpu_shader4' is not supported.
glVersion=2.1, isGlslSupported=YES, glslLanguageVersion=1.1
OpenGL extension 'GL_ARB_vertex_program' is supported.
Setting up osg::Camera::FRAME_BUFFER_OBJECT
OpenGL extension 'GL_ARB_multitexture' is supported.
OpenGL extension 'GL_EXT_texture_filter_anisotropic' is not supported.
OpenGL extension 'GL_ARB_texture_compression' is supported.
OpenGL extension 'GL_EXT_texture_compression_s3tc' is not supported.
OpenGL extension 'GL_IBM_texture_mirrored_repeat' is supported.
OpenGL extension 'GL_EXT_texture_edge_clamp' is supported.
OpenGL extension 'GL_ARB_texture_border_clamp' is supported.
OpenGL extension 'GL_SGIS_generate_mipmap' is supported.
OpenGL extension 'GL_ARB_shadow' is supported.
OpenGL extension 'GL_ARB_shadow_ambient' is supported.
OpenGL extension 'GL_APPLE_client_storage' is not supported.
OpenGL extension 'GL_ARB_texture_non_power_of_two' is supported.
OpenGL extension 'GL_EXT_texture_integer' is not supported.
Setting up osg::Camera::FRAME_BUFFER

Compiling FRAGMENT source:
uniform sampler2D osgShadow_baseTexture;
uniform sampler2DShadow osgShadow_shadowTexture;
uniform vec2 osgShadow_ambientBias;

void main(void)
{
vec4 color = gl_Color * texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy );
gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] ) * osgShadow_ambientBias.y);
}

Linking osg::Program "" id=1 contextID=0
Floating point exception
./a.out: Floating point exception

Thank a lot!

Cheers,
David
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11152

PostPosted: Mon Jun 29, 2015 12:51 pm    Post subject:
Error when using osgShadow
Reply with quote

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 < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
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_ptr<Group> scene (new Group);
        ref_ptr<Geode> objectGeode (new Geode);
        ref_ptr<Geode> terrainGeode (new Geode);
        ref_ptr<Geode> lightMarkerGeode (new Geode);

        //Shadow stuff!!

        ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene;
        ref_ptr<osgShadow::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_ptr<Material> 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:ShockedN);


        //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 /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 /homes/davidb/Downloads/local/lib64/osgPlugins-2.8.1/osgdb_jpeg.so ...
FindFileInPath() : USING /homes/davidb/Downloads/local/lib64/osgPlugins-2.8.1/osgdb_jpeg.so
Opened DynamicLibrary osgPlugins-2.8.1/osgdb_jpeg.so
FindFileInPath(ground.jpg): returning ground.jpg

try to read image
can't read image with osgdb
View::setSceneData() Reusing exisitng scene0x2031480
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
Viewer::realize() - No valid contexts found, setting up view across all screens.
GraphicsContext::getWindowingSystemInterface() 0x2030620        0x7fdb2a28a5f0
GraphicsContext::registerGraphicsContext 0x204b140
GraphicsContext::getWindowingSystemInterface() 0x2030620        0x7fdb2a28a5f0
GraphicsContext::createNewContextID() creating contextID=0
Updating the MaxNumberOfGraphicsContexts to 1
  GraphicsWindow has been created successfully.
Viewer::startThreading() - starting threading
Viewer::startThreading() - contexts.size()=1
Making scene thread safe
Doing add
Doing add
Doing add
  gc->getGraphicsThread()->startThread() 0x233c5e0
Set up threading
View::init()
FocusOut/UnmapNotify event received
FocusIn event received
KeymapNotify event received
CullSettings::readEnvironmentalVariables()
Done DatabasePager::addLoadedDataToSceneGraph0.001ms,   0ms  objects0

Doing run 0x233c5e0 isRunning()=1
OpenGL extensions supported by installed OpenGL drivers are:
    GL_APPLE_packed_pixels
    GL_APPLE_vertex_array_object
    GL_ARB_depth_texture
    GL_ARB_draw_buffers
    GL_ARB_fragment_program
    GL_ARB_fragment_shader
    GL_ARB_half_float_pixel
    GL_ARB_imaging
    GL_ARB_multisample
    GL_ARB_multitexture
    GL_ARB_occlusion_query
    GL_ARB_pixel_buffer_object
    GL_ARB_point_parameters
    GL_ARB_point_sprite
    GL_ARB_shader_objects
    GL_ARB_shading_language_100
    GL_ARB_shading_language_120
    GL_ARB_shadow
    GL_ARB_shadow_ambient
    GL_ARB_texture_border_clamp
    GL_ARB_texture_compression
    GL_ARB_texture_cube_map
    GL_ARB_texture_env_add
    GL_ARB_texture_env_combine
    GL_ARB_texture_env_crossbar
    GL_ARB_texture_env_dot3
    GL_ARB_texture_mirrored_repeat
    GL_ARB_texture_non_power_of_two
    GL_ARB_texture_rectangle
    GL_ARB_transpose_matrix
    GL_ARB_vertex_buffer_object
    GL_ARB_vertex_program
    GL_ARB_vertex_shader
    GL_ARB_window_pos
    GL_ATI_blend_equation_separate
    GL_ATI_fragment_shader
    GL_ATI_separate_stencil
    GL_ATI_texture_env_combine3
    GL_ATI_texture_mirror_once
    GL_EXT_abgr
    GL_EXT_bgra
    GL_EXT_blend_color
    GL_EXT_blend_equation_separate
    GL_EXT_blend_func_separate
    GL_EXT_blend_logic_op
    GL_EXT_blend_minmax
    GL_EXT_blend_subtract
    GL_EXT_clip_volume_hint
    GL_EXT_compiled_vertex_array
    GL_EXT_convolution
    GL_EXT_copy_texture
    GL_EXT_depth_bounds_test
    GL_EXT_draw_range_elements
    GL_EXT_fog_coord
    GL_EXT_framebuffer_blit
    GL_EXT_framebuffer_object
    GL_EXT_gpu_program_parameters
    GL_EXT_histogram
    GL_EXT_multi_draw_arrays
    GL_EXT_packed_depth_stencil
    GL_EXT_packed_pixels
    GL_EXT_paletted_texture
    GL_EXT_pixel_buffer_object
    GL_EXT_point_parameters
    GL_EXT_polygon_offset
    GL_EXT_rescale_normal
    GL_EXT_secondary_color
    GL_EXT_separate_specular_color
    GL_EXT_shadow_funcs
    GL_EXT_shared_texture_palette
    GL_EXT_stencil_wrap
    GL_EXT_subtexture
    GL_EXT_texture
    GL_EXT_texture3D
    GL_EXT_texture_edge_clamp
    GL_EXT_texture_env_add
    GL_EXT_texture_env_combine
    GL_EXT_texture_env_dot3
    GL_EXT_texture_lod_bias
    GL_EXT_texture_mirror_clamp
    GL_EXT_texture_object
    GL_EXT_texture_rectangle
    GL_EXT_texture_sRGB
    GL_EXT_timer_query
    GL_EXT_vertex_array
    GL_IBM_multimode_draw_arrays
    GL_IBM_rasterpos_clip
    GL_IBM_texture_mirrored_repeat
    GL_INGR_blend_func_separate
    GL_MESA_pack_invert
    GL_MESA_program_debug
    GL_MESA_resize_buffers
    GL_MESA_window_pos
    GL_MESA_ycbcr_texture
    GL_NV_blend_square
    GL_NV_fragment_program
    GL_NV_light_max_exponent
    GL_NV_point_sprite
    GL_NV_texgen_reflection
    GL_NV_texture_rectangle
    GL_NV_vertex_program
    GL_NV_vertex_program1_1
    GL_OES_read_format
    GL_SGIS_generate_mipmap
    GL_SGIS_texture_border_clamp
    GL_SGIS_texture_edge_clamp
    GL_SGIS_texture_lod
    GL_SGIX_depth_texture
    GL_SGIX_shadow
    GL_SGIX_shadow_ambient
    GL_SGI_color_matrix
    GL_SGI_color_table
    GL_SGI_texture_color_table
    GL_SUN_multi_draw_arrays
OpenGL extension 'GL_ARB_vertex_program' is supported.
OpenGL extension 'GL_EXT_secondary_color' is supported.
OpenGL extension 'GL_EXT_fog_coord' is supported.
OpenGL extension 'GL_ARB_multitexture' is supported.
OpenGL extension 'GL_NV_occlusion_query' is not supported.
OpenGL extension 'GL_ARB_occlusion_query' is supported.
OpenGL extension 'GL_EXT_timer_query' is supported.
OpenGL extension '' is not supported.
Done DatabasePager::addLoadedDataToSceneGraph0ms,       0.001ms  objects0

OpenGL extension 'GL_ARB_pixel_buffer_object' is supported.
OpenGL extension 'GL_ARB_fragment_program' is supported.
OpenGL extension 'GL_EXT_framebuffer_object' is supported.
OpenGL extension 'GL_EXT_framebuffer_blit' is supported.
OpenGL extension 'GL_EXT_framebuffer_multisample' is not supported.
OpenGL extension 'GL_NV_framebuffer_multisample_coverage' is not supported.
OpenGL extension 'GL_EXT_packed_depth_stencil' is supported.
OpenGL extension 'GL_ARB_shader_objects' is supported.
OpenGL extension 'GL_ARB_vertex_shader' is supported.
OpenGL extension 'GL_ARB_fragment_shader' is supported.
OpenGL extension 'GL_ARB_shading_language_100' is supported.
OpenGL extension 'GL_EXT_geometry_shader4' is not supported.
OpenGL extension 'GL_EXT_gpu_shader4' is not supported.
glVersion=2.1, isGlslSupported=YES, glslLanguageVersion=1.1
OpenGL extension 'GL_ARB_vertex_program' is supported.
Setting up osg::Camera::FRAME_BUFFER_OBJECT
OpenGL extension 'GL_ARB_multitexture' is supported.
OpenGL extension 'GL_EXT_texture_filter_anisotropic' is not supported.
OpenGL extension 'GL_ARB_texture_compression' is supported.
OpenGL extension 'GL_EXT_texture_compression_s3tc' is not supported.
OpenGL extension 'GL_IBM_texture_mirrored_repeat' is supported.
OpenGL extension 'GL_EXT_texture_edge_clamp' is supported.
OpenGL extension 'GL_ARB_texture_border_clamp' is supported.
OpenGL extension 'GL_SGIS_generate_mipmap' is supported.
OpenGL extension 'GL_ARB_shadow' is supported.
OpenGL extension 'GL_ARB_shadow_ambient' is supported.
OpenGL extension 'GL_APPLE_client_storage' is not supported.
OpenGL extension 'GL_ARB_texture_non_power_of_two' is supported.
OpenGL extension 'GL_EXT_texture_integer' is not supported.
Setting up osg::Camera::FRAME_BUFFER

Compiling FRAGMENT source:
uniform sampler2D osgShadow_baseTexture;
uniform sampler2DShadow osgShadow_shadowTexture;
uniform vec2 osgShadow_ambientBias;

void main(void)
{
    vec4 color = gl_Color * texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy );
    gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] ) * osgShadow_ambientBias.y);
}

Linking osg::Program "" id=1 contextID=0
Floating point exception
./a.out: Floating point exception

Thank a lot!

Cheers,
David

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
davboub
Newbie


Joined: 29 Jun 2015
Posts: 2

PostPosted: Mon Jun 29, 2015 1:19 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11152

PostPosted: Mon Jun 29, 2015 1:38 pm    Post subject:
Error when using osgShadow
Reply with quote

Hi David,

On 29 June 2015 at 14:19, david boublil < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
What do you mean by tracking with a debugger?


A debugger as in gdb, VisualStudio etc.


 
Quote:
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.
 
Quote:
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.

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 788

PostPosted: Mon Jun 29, 2015 2:01 pm    Post subject:
Error when using osgShadow
Reply with quote

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
Quote:
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









------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Compile error with Visual Studio 2017 draccagni General 2 Sat Aug 19, 2017 1:52 pm View latest post
No new posts PHPBB ERROR: A Closer Look, and Why Steal General 0 Mon Jul 10, 2017 11:03 am View latest post
No new posts PBuffer causing error when profiling ... jsmitq General 1 Thu Jun 08, 2017 4:24 pm View latest post
No new posts Error with InputStream reading osgb f... Riccardo Corsi General 28 Thu Jun 08, 2017 11:20 am View latest post
No new posts OpenGL error when using TextureBuffer MariusD General 1 Mon May 22, 2017 1:40 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP