Alexandre Vaillancourt | 23 Oct 16:20 2014
Picon

Slave camera question

Hello users!

I'm currently trying to re-implement the example osgdistortion in another test application to see how it works.

I'm facing this issue. If I run the osgdistortion example with the "--dome" parameter, and that I comment all the "viewer.addSlave" calls, I get the expected result of seeing only my model with no distortion.

However, if I add only the first call to the "viewer.addSlave" (in "setDomeCorrection"; front face part), which in theory renders to a cube texture, I no longer see my model and the screen is all black.

I'm having trouble figuring out what's going on in there, I would expect to still see my model not distorted. Any pointers would be appreciated!

I've been using the 'scene graph' part of osg for a couple of years now, but the OpenGL aspect of it is still unclear.

Thanks!

--
Alexandre Vaillancourt
<div><div dir="ltr">
<div>
<div>
<div>
<div>Hello users!<br><br>
</div>I'm currently trying to re-implement the example osgdistortion in another test application to see how it works.<br><br>
</div>I'm facing this issue. If I run the osgdistortion example with the "--dome" parameter, and that I comment all the "viewer.addSlave" calls, I get the expected result of seeing only my model with no distortion. <br><br>
</div>However, if I add only the first call to the "viewer.addSlave" (in "setDomeCorrection"; front face part), which in theory renders to a cube texture, I no longer see my model and the screen is all black. <br><br>
</div>I'm having trouble figuring out what's going on in there, I would expect to still see my model not distorted. Any pointers would be appreciated!<br><br>I've been using the 'scene graph' part of osg for a couple of years now, but the OpenGL aspect of it is still unclear. <br><div><div>
<div><br></div>
<div>Thanks!<br>
</div>
<div>
<br clear="all"><div><div>
<div><div dir="ltr">--<br>Alexandre Vaillancourt<br>
</div></div>
</div></div>
</div>
</div></div>
</div></div>
Trajce Nikolov NICK | 23 Oct 12:57 2014
Picon

invalid enumerant error

Hi community,

This is question for those who has debug OpenGL apps. I am getting the following message:

"Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0x40b3"

Any hints how to resolve it or at least get some more info?

Thanks a lot,

Nick

--
trajce nikolov nick
<div><div dir="ltr">Hi community,<div><br></div>
<div>This is question for those who has debug OpenGL apps. I am getting the following message:</div>
<div><br></div>
<div>"Warning: detected OpenGL error 'invalid enumerant' after applying GLMode 0x40b3"</div>
<div><br></div>
<div>Any hints how to resolve it or at least get some more info?</div>
<div><br></div>
<div>Thanks a lot,</div>
<div><br></div>
<div>Nick<br clear="all"><div><br></div>-- <br>trajce nikolov nick<br>
</div>
</div></div>
Dheeraj Jain | 22 Oct 12:50 2014
Picon

Flickering in PSSM shadows.

Hi,

I am using OSG 3.1 and I am facing a issue of flickering in PSSM shadows. I am using single threaded mode.
I think the problem is related to the the split distances. These are calculated per frame as soon as camera
position changes , If I use static split distances,I am not getting those flickers,but shadow quality
highly decreases in the split edges.
Please help me resolve this.

Thank you!

Cheers,
dheeraj

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

Michael Grey | 23 Oct 04:33 2014
Picon

Re: model rendering glitch on osg versions > 3.0.1

Hi,

I'm running into an issue that I think is related, but not exactly the same.

Prior to the 3.2 release, I could load an .stl file using the osgDB::readNodeFile(~) function, and it would
come out looking like a diffuse white material. Presumably this was just a default setting somewhere in
OSG or OpenGL, because the .stl file doesn't encode color or material properties.

In the latest release, the file gets loaded as a shiny golden color (attachment "A").

I tried applying setGlobalDefaults() to the Viewer's Camera, but this had no effect. I also tried applying
setGlobalDefaults() to the node which gets generated from osgDB::readNodeFile(~), and this changed
the golden color to a blackish color (attachment "B").

I found that I could crawl through the auto-generated node and parse out its geodes and geometries, then
change their color array to whatever I want. I imagine I could do something similar with their materials to
get rid of the shininess. However, this is a problem for two reasons: (1) It's annoying, and more
importantly (2) If some color/material properties are loaded from the file, I don't want to overwrite them.

I'd really just like a way to get back the behavior prior to 3.2 where a loaded node would have some reasonable
default rendering properties if the properties aren't provided by the file that's being loaded.

If anyone has suggestions for how I might be able to accomplish this in a robust way, I would greatly
appreciate it! I suspect there's probably some stupidly simple thing I could do that I'm just not aware of
because of my inexperience with OSG.

Thanks!

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

Attachments: 
http://forum.openscenegraph.org//files/dark_robot_376.png
http://forum.openscenegraph.org//files/gold_robot_174.png

Guy Barlow | 22 Oct 13:11 2014

Quad Buffer Stereo in osgViewer::CompositeViewer

Hi,

I've been struggling with this for over a week now, its really blocking progress on my project.

Basically, I can't seem to get quad buffer stereo working in any sort of compositeviewer. For what its
worth, both the osgcompositeviewer example and my own application show the same error : 

Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)

..and refuse to show anything other than a mono view. 

I get the same issue on both my builds: a MinGW Windows 7 build and a gcc build on Arch Linux.

My OpenSceneGraph is built from source in both cases using the latest revision in trunk (14459)

Finally all other stereo modes seem to work in all cases, on both builds. I've been trying to track the
problem down using a debugger without any luck. 

I'm going to try and debug the GL calls next, but was wondering if anyone else had experienced anything similar.
... 

Thank you!

Cheers,
Guy

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

Trieu Hung | 22 Oct 05:21 2014
Picon

Re: load example iphoneviewer error !!!

Hi,

CullSettings::readEnvironmentalVariables()
DatabasePager::addDatabaseThread() HANDLE_NON_HTTP
DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
ShaderComposer::ShaderComposer() 0x8abc5e0
CullSettings::readEnvironmentalVariables()
ShaderComposer::ShaderComposer() 0x8abd4d0
GraphicsContext::registerGraphicsContext 0xa8a6a60
ShaderComposer::ShaderComposer() 0xa8a6cd0
GraphicsContext::createNewContextID() creating contextID=0
Updating the MaxNumberOfGraphicsContexts to 1
uncompressed ive stream
CullSettings::readEnvironmentalVariables()
   Font 0xa8a8870, numberOfTexturesAllocated 1
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
View::setSceneData() Reusing exisitng scene0x8ababf0
 CameraManipulator::computeHomePosition(0, 0)
    boundingSphere.center() = (26634 37420 3733.74)
    boundingSphere.radius() = 37260.7
 CameraManipulator::computeHomePosition(0x9221200, 0)
    boundingSphere.center() = (26634 37420 3733.74)
    boundingSphere.radius() = 37260.7
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
Warning: dynamic library 'osgPlugins-3.3.1/osgdb_freetype.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.3.1/osgdb_freetype.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.3.1/osgdb_freetype.so"
No valid object found for /Library/Fonts/Arial.ttf
GraphicsContext::getWindowingSystemInterface() 0x8a970c0	0x719bd4
osg::State::_maxTexturePoolSize=0
osg::State::_maxBufferObjectPoolSize=0
GraphicsContext::getWindowingSystemInterface() 0x8a970c0	0x719bd4
updateDimensions, resize to 0 0 220 380
GraphicsWindowIOS :: grabFocusIfPointerInWindow not implemented yet 
View::init()
OpenGL extensions supported by installed OpenGL drivers are:
    GL_APPLE_copy_texture_levels
    GL_APPLE_framebuffer_multisample
    GL_APPLE_texture_2D_limited_npot
    GL_APPLE_texture_format_BGRA8888
    GL_APPLE_texture_max_level
    GL_EXT_blend_minmax
    GL_EXT_debug_label
    GL_EXT_debug_marker
    GL_EXT_discard_framebuffer
    GL_EXT_map_buffer_range
    GL_EXT_read_format_bgra
    GL_EXT_texture_filter_anisotropic
    GL_EXT_texture_lod_bias
    GL_EXT_texture_storage
    GL_IMG_read_format
    GL_IMG_texture_compression_pvrtc
    GL_OES_blend_equation_separate
    GL_OES_blend_func_separate
    GL_OES_blend_subtract
    GL_OES_compressed_paletted_texture
    GL_OES_depth24
    GL_OES_draw_texture
    GL_OES_element_index_uint
    GL_OES_fbo_render_mipmap
    GL_OES_framebuffer_object
    GL_OES_mapbuffer
    GL_OES_matrix_palette
    GL_OES_packed_depth_stencil
    GL_OES_point_size_array
    GL_OES_point_sprite
    GL_OES_read_format
    GL_OES_rgb8_rgba8
    GL_OES_stencil8
    GL_OES_stencil_wrap
    GL_OES_texture_mirrored_repeat
    GL_OES_vertex_array_object
OpenGL extension 'GL_ARB_vertex_shader' is not supported.
OpenGL extension 'GL_ARB_multitexture' is not supported.
OpenGL extension 'GL_EXT_multitexture' is not supported.
OpenGL extension 'GL_ARB_vertex_program' is not supported.
OpenGL extension 'GL_EXT_secondary_color' is not supported.
OpenGL extension 'GL_EXT_fog_coord' is not supported.
OpenGL extension 'GL_ARB_multitexture' is not supported.
OpenGL extension 'GL_NV_occlusion_query' is not supported.
OpenGL extension 'GL_ARB_occlusion_query' is not supported.
OpenGL extension 'GL_EXT_timer_query' is not supported.
OpenGL extension 'GL_ARB_timer_query' is not supported.
GraphicsCostEstimator::calibrate(..)
ShaderComposer::~ShaderComposer() 0x8abc5e0
OpenGL extension 'GL_EXT_texture_filter_anisotropic' is supported.
OpenGL extension 'GL_ARB_texture_swizzle' is not supported.
OpenGL extension 'GL_ARB_texture_compression' is not supported.
OpenGL extension 'GL_EXT_texture_compression_s3tc' is not supported.
OpenGL extension 'GL_IMG_texture_compression_pvrtc' is supported.
OpenGL extension 'GL_OES_compressed_ETC1_RGB8_texture' is not supported.
OpenGL extension 'GL_ARB_ES3_compatibility' is not supported.
OpenGL extension 'GL_EXT_texture_compression_rgtc' is not supported.
OpenGL extension 'GL_IMG_texture_compression_pvrtc' is supported.
OpenGL extension 'GL_IBM_texture_mirrored_repeat' is not supported.
OpenGL extension 'GL_ARB_texture_mirrored_repeat' is not supported.
OpenGL extension 'GL_EXT_texture_edge_clamp' is not supported.
OpenGL extension 'GL_SGIS_texture_edge_clamp' is not supported.
OpenGL extension 'GL_SGIS_generate_mipmap' is not supported.
OpenGL extension 'GL_ARB_texture_multisample' is not supported.
OpenGL extension 'GL_ARB_shadow' is not supported.
OpenGL extension 'GL_ARB_shadow_ambient' is not supported.
OpenGL extension 'GL_APPLE_client_storage' is not supported.
OpenGL extension 'GL_ARB_texture_non_power_of_two' is not supported.
OpenGL extension 'GL_APPLE_texture_2D_limited_npot' is supported.
OpenGL extension 'GL_EXT_texture_integer' is not supported.
Created new 0x8c81460 TextureObject, _numOfTextureObjects 1
OpenGL extension 'GL_EXT_packed_depth_stencil' is not supported.
OpenGL extension 'GL_OES_packed_depth_stencil' is supported.
OpenGL extension '' is not supported.
Setting up osg::Camera::FRAME_BUFFER
Warning: TexEnv::apply(State&) - not supported.
OpenGL extension 'GL_ARB_vertex_buffer_object' is not supported.
Warning: TexEnv::apply(State&) - not supported.
Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)
Setting up osg::Camera::FRAME_BUFFER
Created new 0x8c881d0 TextureObject, _numOfTextureObjects 1
glGetString(GL_RENDERER)==Apple Software Renderer
before Glyph::subload(): detected OpenGL error: invalid operation
Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)
updateDimensions, resize to 0 0 220 380
OpenGL extension 'GL_ARB_shader_objects' is not supported.
OpenGL extension 'GL_ARB_vertex_shader' is not supported.
OpenGL extension 'GL_ARB_fragment_shader' is not supported.
OpenGL extension 'GL_ARB_shading_language_100' is not supported.
OpenGL extension 'GL_EXT_geometry_shader4' is not supported.
OpenGL extension 'GL_EXT_gpu_shader4' is not supported.
OpenGL extension 'GL_ARB_tessellation_shader' is not supported.
OpenGL extension 'GL_ARB_uniform_buffer_object' is not supported.
OpenGL extension 'GL_ARB_get_program_binary' is not supported.
OpenGL extension 'GL_ARB_gpu_shader_fp64' is not supported.
OpenGL extension 'GL_ARB_shader_atomic_counters' is not supported.
glVersion=1.1, isGlslSupported=NO, glslLanguageVersion=0
Warning: TexEnv::apply(State&) - not supported.
Warning: TexEnv::apply(State&) - not supported.
Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)
Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)
Warning: TexEnv::apply(State&) - not supported.
Warning: TexEnv::apply(State&) - not supported.
Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..)

Mac 10.9 xcode 5.1.1 ios framework 6.0 OpenSceneGraph 3.3.1

help me !!!

... 

Thank you!

Cheers,
hunglkt

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

Gianni Ambrosio | 23 Oct 09:18 2014
Picon

osgGA::GUIEventHandler deprecated method

Hi All,
I'm trying to implement picking and I found some examples where a deprecated method of
osgGA::GUIEventHandler is used:

bool handle(const osgGA::GUIEventAdapter&, osgGA::GUIActionAdapter&);

This method seems deprecated at least from 3.0.1 to 3.2.1.
So, which method should be used instead? Maybe the following one?

bool 	handle (const GUIEventAdapter &ea, GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)

Cheers,
Gianni

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

David Fries | 23 Oct 05:51 2014
Picon

GeometryTechnique race condition crash

We're getting a crash with some ive paged terrains, it was being ht
when the system was under load with 7 OSG application instances all
thrashing their pagers.  I've tracked it down to a race condition and
included two patches, the first adds a sleep to greatly increase the
chance of the crash to reproduce it, the second is a potential fix.
I've verified trunk crashes.  The first one obviously is not to be
committed.  I don't know enough about GeometryTechnique to know if
there is a better way to fix it, so I didn't include the full file as
I didn't think it was ready to submit.

I would have thought a subtree would either be being processed by the
DatabasePager or in the main scene graph for draw, but not both at the
same time, and something is happening to cause one to be deleting
nodes while the other is trying to compile the state sets.  Any ideas?

-------------------------------
cause GeometryTechnique::traverse crash

Add a sleep to widen the race condition to demonstrate a crash in
GeometryTechnique::traverse

partial stack trace of the crashing thread,
osg::NodeVisitor::traverse
osgUtil::StateToCompile::apply
osg::NodeVisitor::apply
osg::NodeVisitor::apply
osg::NodeVisitor::apply
osg::MatrixTransform::accept
osgTerrain::GeometryTechnique::traverse
osgTerrain::TerrainTile::traverse
osg::NodeVisitor::traverse
osgUtil::StateToCompile::apply
...
osg::Group::accept
osgDB::DatabasePager::DatabaseThread::run

The additional sleep allows another thread to call
GeometryTechnique::init which leaves a dangling pointer for this code.

main thread,
osg::MatrixTransform::~MatrixTransform()
osg::Referenced::signalObserversAndDelete
osg::Referenced::unref
osg::ref_ptr<osg::MatrixTransform>::~ref_ptr()
osgTerrain::GeometryTechnique::BufferData::~BufferData()
osgTerrain::GeometryTechnique::BufferData::~BufferData()
osg::Referenced::signalObserversAndDelete
assign<osgTerrain::GeometryTechnique::BufferData>
operator=
osgTerrain::GeometryTechnique::init(int, bool)
(GeometryTechnique.cpp:145)
---
 src/osgUtil/IncrementalCompileOperation.cpp |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/osgUtil/IncrementalCompileOperation.cpp b/src/osgUtil/IncrementalCompileOperation.cpp
index 520f4db..dff6354 100644
--- a/src/osgUtil/IncrementalCompileOperation.cpp
+++ b/src/osgUtil/IncrementalCompileOperation.cpp
 <at>  <at>  -67,6 +67,9  <at>  <at>  void StateToCompile::apply(osg::Node& node)
         apply(*(node.getStateSet()));
     }

+    // widen the race condition to demonstrate GeometryTechnique::traverse causing a crash
+    OpenThreads::Thread::microSleep(100000);
+
     traverse(node);
 }

-- 
1.7.10.4

-------------------------------

add a lock to GeometryTechnique::traverse

One thread can be in init while another in traverse and the end result
is a crash.
---
 include/osgTerrain/GeometryTechnique |    3 ++-
 src/osgTerrain/GeometryTechnique.cpp |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/osgTerrain/GeometryTechnique b/include/osgTerrain/GeometryTechnique
index fdb0df4..071e0c6 100644
--- a/include/osgTerrain/GeometryTechnique
+++ b/include/osgTerrain/GeometryTechnique
 <at>  <at>  -20,6 +20,7  <at>  <at> 

 #include <osgTerrain/TerrainTechnique>
 #include <osgTerrain/Locator>
+#include <OpenThreads/ReentrantMutex>

 namespace osgTerrain {

 <at>  <at>  -99,7 +100,7  <at>  <at>  class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique
         virtual void applyTransparency(BufferData& buffer);

 
-        OpenThreads::Mutex                  _writeBufferMutex;
+        OpenThreads::ReentrantMutex         _writeBufferMutex;
         osg::ref_ptr<BufferData>            _currentBufferData;
         osg::ref_ptr<BufferData>            _newBufferData;

diff --git a/src/osgTerrain/GeometryTechnique.cpp b/src/osgTerrain/GeometryTechnique.cpp
index e1c461b..9b161e0 100644
--- a/src/osgTerrain/GeometryTechnique.cpp
+++ b/src/osgTerrain/GeometryTechnique.cpp
 <at>  <at>  -1451,6 +1451,7  <at>  <at>  void GeometryTechnique::cull(osgUtil::CullVisitor* cv)
 void GeometryTechnique::traverse(osg::NodeVisitor& nv)
 {
     if (!_terrainTile) return;
+    OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_writeBufferMutex);

     // if app traversal update the frame count.
     if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
--

-- 
1.7.10.4

Filipe P | 23 Oct 01:03 2014
Picon

Re: How do I adapt the osgViewer::Viewer in order to have my model in fullscreen mode?

Hi All,
first, thanks cbuchner1 and robertosfield for their last hints.

The code that was missing is the following:
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
camera->setProjectionMatrixAsOrtho2D(0.0, traits->width, 0.0, traits->height);

Now I have a strange error that I cannot understand.
The model was not rendered correctly yet. 

The image is now on the left-bottom side of the screen.
Somehow, the image is scalling from 1600x900px to 2048x1024px. (reported on the OSG console)

Someone can explain me what is missing?!

I'm using an *.flt model with (inside of this openFlight model) an image (*.rgba) applied to a polygon with
the same size (1600x900px).

Some kind of help would be great.

Thanks in advance!

Best Regards,
Filipe

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

Carlos Sanches | 22 Oct 15:24 2014
Picon

osgEarth Sky enable

Hello !
How do I have to setup the SkyNode by code?
In the past I sed this:

    // SKY
    const Config& externals = mapNode->externalConfig();
    Config skyConf = externals.child( "sky" );
    double hours = skyConf.value( "hours", 3.0 );
    s_sky = new SkyNode( mapNode->getMap() );
    s_sky->setDateTime( 2011, 3, 6, hours );
    s_sky->attach( &viewer );
    root->addChild( s_sky );

But now this is not working . What do I m doing wrong please?
--
 
<div><div dir="ltr">Hello !<br>How do I have to setup the SkyNode by code?<br>In the past I sed this:<br><div>
<div>
<br>&nbsp;&nbsp;&nbsp; // SKY<br>&nbsp;&nbsp;&nbsp; const Config&amp; externals = mapNode-&gt;externalConfig();<br>&nbsp;&nbsp;&nbsp; Config skyConf = externals.child( "sky" );<br>&nbsp;&nbsp;&nbsp; double hours = skyConf.value( "hours", 3.0 );<br>&nbsp;&nbsp;&nbsp; s_sky = new SkyNode( mapNode-&gt;getMap() );<br>&nbsp;&nbsp;&nbsp; s_sky-&gt;setDateTime( 2011, 3, 6, hours );<br>&nbsp;&nbsp;&nbsp; s_sky-&gt;attach( &amp;viewer );<br>&nbsp;&nbsp;&nbsp; root-&gt;addChild( s_sky );<br><br>
</div>But now this is not working . What do I m doing wrong please? <br>-- <br>&nbsp;<br>
</div>
</div></div>
Chris Hidden | 21 Oct 16:20 2014

Low frame rate ( Update Callback on 50 bones ).

Hey everyone.

I've come a far way since my last post.  Our application is reading sensor data from the Leap Motion and we are
interpreting this data and using OSG to display the hand models on scene.  The issue now is that running on my
laptop I get a tops of 20 fps.  On other computers with lower specs the fr is abysmal.

The way its set up right now is that we load the fbx model of a hand and traverse through its nodes.  If it finds a
bone and if it is one of the bones we want to affect we attach an updateCallback.  The update callback queries
our data for a new position and the position is updated using a matrix and then the new position is set: 

Code:

osg::ref_ptr<osgAnimation::Bone>	bone			= dynamic_cast<osgAnimation::Bone*>(node);
	
	if (bone)
	{
		ref_ptr<osgAnimation::Bone>	parent				= bone->getBoneParent();
		const osg::Matrix&			matrix				= _transforms.getMatrix();
		_transforms.update					();
		setBoneOrientations					();
		setLocalMatrices					        ();
		setLocalTranslationsAndRotations	(parent, &matrix);
		
	
		
		

		if (parent)
			bone->setMatrixInSkeletonSpace(fingerSpace * fingerTranslation * parent->getMatrixInSkeletonSpace());
	}

	traverse(node, nv);

The setBoneOrientations(), setLocalMatrices() and setLocalTranslationsAndRotation() are methods
used to manipulate the data so the it fits the position and rototaion on the screen properly. Basically
converting the data to osg coordinate spaces. 

The viewer is basically just while(!viewer->done())

I believe in total we end up attaching a callback to about 40 - 50 bones.  20-25 on each hand.  This doesn't feel
like too much to process but Im no expert... far from it.   Is this the reason causing my low frame rate?  If so
what are some steps or things to start looking at to improve performance.  

Thanks everyone!

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


Gmane