Re: [osg-users] A bug in multi-threaded osgTerrain (with proposed fix) plus assorted questions

2014-04-23 Thread Sylvain Comtois
Hi,

I made some more test and to solve the problem i only have to be sure that 
the assumeMultiThreaded parameter of the GeometryTechnique::init is set to 
true. 

   In OSG 3.2, i change 5 values. Two in the GeometryTechnique::traverse(), two 
more in TerrainTechnique::traverse() and the last in TerrainTile::traverse().

Cheers,
Sylvain

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





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


Re: [osg-users] A bug in multi-threaded osgTerrain (with proposed fix) plus assorted questions

2014-04-22 Thread Sylvain Comtois
Hi,

   I have a similar problem when i create an OSGTerrain node in a multithread 
configuration. The crash occur in the init function of the GeometryTechnique 
class. Note i use OSG 3.2.

   To solve this problem, i made a small modification to OSG itself. 

   I replace the line 
  if (!_currentBufferData || !assumeMultiThreaded)
   by
  if (!_currentBufferData  !assumeMultiThreaded)
   in the GeometryTechnique::init function.

   I also replace the line 
  init(getDirtyMask(), false);
   by 
  init(getDirtyMask(), true);
   in the TerrainTile::traverse function.

   With this modification, the currentBuffer is create in the Update traversal 
(one thread) instead of the cull/draw traversal (multi-thread).

   Maybe it's better to wait for OSG team approval before you made this 
modification. 

Cheers,
Sylvain

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





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


Re: [osg-users] setLightingMode crash in multithread mode

2014-04-22 Thread Sylvain Comtois
Hi Robert,

   I use two way to modify my scene graph. 

   The first one is using the UpdateCallback each time it is possible. 
   The second one is when we are outside the ViewerBase::frame() function.
   Our application have a lot of threads and i use a mutex to be sure the OSG 
tree is never access in the same time by two or more threads.

The code like this:

   mRenderingTreeMutex.lock
   mViewer-frame()
   mRenderingTreeMutex.Unlock

   And each time i touch the OSG tree, i use the same mutex.

   mRenderingTreeMutex.lock
   Modifiying OSG tree
   mRenderingTreeMutex.Unlock

   So in my case i call the Viewer::setLightingMode between my 
mRenderingTreeMutex and the function modify the internal variable 
_lightingMode. According to the debugger, this variable is process during the 
cull_draw that is made by all camera's thread in the same time.

   So, during one thread call the _globalStateSet-removeMode(GL_LIGHTING) 
function, another one use the _globalStateSet variable and this variable is the 
same for all threads that cause the crash.

   Everything append in the void SceneView::setLightingMode(LightingMode mode) 
function.

   To temporary solve my problem, i add a mutex to protect the access to the 
_globalStateSet variable.

   Maybe this variable can be process in the update instead of the cull/draw?

Thank you!

Cheers,
Sylvain

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





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


Re: [osg-users] A bug in multi-threaded osgTerrain (with proposed fix) plus assorted questions

2014-04-22 Thread Sylvain Comtois
Hi,

Humm, forget my solution. She's not working.

Thank you!

Cheers,
Sylvain

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





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


[osg-users] setLightingMode crash in multithread mode

2014-04-20 Thread Sylvain Comtois
Hi,

First, my program work without any problem when the threading model is 
configure to single thread and i use  one master camera and tree slaves cameras 
on a multiprocessor computer.

   When i call the method Viewer::setLightingMode of my viewer, osg crash when 
the method osgViewer::Renderer::cull is call by the threading engine.

The crash occur in the following method sequence:

...
osg100-osgd.dll!osg::StateSet::setModeToInherit
osg100-osgd.dll!osg::StateSet::removeMode
osg100-osgUtild.dll!osgUtil::SceneView::setLightingMode
osg100-osgUtild.dll!osgUtil::SceneView::inheritCullSettings
osg100-osgUtild.dll!osgUtil::SceneView::inheritCullSettings
osg100-osgViewerd.dll!osgViewer::Renderer::cull
osg100-osgViewerd.dll!osgViewer::Renderer::operator()   
osg100-osgd.dll!osg::OperationThread::run()ot13-openThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread

   Note that i have more then one thread that call the removeMode method in the 
same time when the error occure.

   I set the viewer data variance to DYNAMIC but when i debug the program, the 
SceneView data variance is still unspecified. I also set the data variance of 
each camera to DYNAMIC.

   Does i have to set the data variance of something else to DYNAMIC?

Thank you!

Cheers,
Sylvain

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





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


Re: [osg-users] Wrong geode display on screen

2014-04-18 Thread Sylvain Comtois
Hi,

I finally found that the problem is related with the display list of 
drawables. When the viewer is delete all display list and gl context are 
destroy but the drawable are still existing and keep a reference to the context 
and the display list.

When we create the new viewer, we have new context and no displaylist. When 
the drawable is add to the new rendering tree and the context and display list 
reference exist in the display list (create by another drawable) exist, he use 
it but the display list correspond to the display list of another drawable.

   So we decide to recreate the drawable when the viewer is recreate.

   We also observe when we destroy the viewer, we must destroy the camera of 
the viewer before destroying the viewer itself. The problem is the viewer is 
destroying context before destroying cameras. When the context are destroy, 
they erase the display list cache. After when cameras are destroy they destroy 
the remaining scene graph tree and destroy drawable that cannot remove the 
display list from the context because the context are already erase the display 
list cache.

   This will not be a problem if context are really destroy. But when we 
recreate the viewer, some old context are reuse with they old display list 
inside them.

   I'm not 100% certain of what append inside OSG but destroying the cameras 
before the viewer solve my problem.

Thank you!

Cheers,
Sylvain

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





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


Re: [osg-users] Wrong geode display on screen

2014-04-17 Thread Sylvain Comtois
Hi Robert,

   We use the last stable release 3.2.

Thank you!

Cheers,
Sylvain

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





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


[osg-users] Wrong geode display on screen

2014-02-25 Thread Sylvain Comtois
Hi,

   We have a pretty complex software, under windows, that have a window the 
user can close and open for 3D rendering with OSG.

   When the user close the window we delete all OSG object except some node 
create from .osg or .ive files to speed up the next load process.

   The first time the user open the window we create the viewer and we load the 
nodes and everything just work perfectly. When the user close the window, 
everything is delete and we keep some nodes in a table.

   The next time the user open the window we recreate the viewer and we create 
new node and use again node store in the table. In this second or subsequent 
creation of the window we have some or all of the nodes, stock in the table, 
that are not display correctly. The nodes newly create are always corrects.

   By example, if we have a table with four objects (car, plane, box and ball) 
the ball can be show in place of the car or sometime just nothing is showed.

   We believe we using the correct geode because of the followings test: First 
we save the geode in osg file for the first time we open the window when the 
geode is correct and in the next time the geode is not correct. We compare the 
two files and the only difference are UniqueID MatricTransform_0 and UniqueID 
StateSet_0.

Second we draw a bounding box around the object and the bounding correspond to 
the object we expected to be show.  We use the ComputeBoundVistor to find the 
dimensions of the object.

   The software is also use in a realty center (cave) when in this 
configuration we use 4 cameras when each camera represent a wall of the cave. 
We have one master camera with three slaves cameras sharing the same scene data 
and the same viewer.

   In this configuration we can also observe the problem but in a different 
manner. Some camera show the right geode and some show a wrong geode. We only 
have to move the geode from one camera to another to see the two representation 
of the geode. Like in one camera mode, the problem is never present the first 
time we open the windows.

   To clear the osg environment, we only set all reference pointer we use to 0 
(viewer, scenegraph, cameras, etc). We also verify in the debug log that the 
destructor of the viewer is called.

   But according to the log, it seem the 'GraphicContext' is not completely 
close.

   Do we have to do something else to perfectly clean all the OSG environment. 
Does OSG use internal cache table that we need to reset ?

Thank you!

Cheers,
Sylvain

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





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