Re: [osg-users] dynamic multithreading problem

2012-10-03 Thread Filip Arlet
Hi,

I think the problem maybe located in my custom Drawable class. It draws text 
geometry instead of textured quads (like in osgText::Test). It basicaly works 
like Group with multiple transforms and geodes with character geometry. But I 
really need it to be Drawable (structure of transform will be memory consuming 
and I can attach it to Geode in the same way as I attach regular osgText::Text).


How it works:
My custom Drawable calls draw method of every character geometry in it, some 
characters have program in their stateset so I have to call 
state.apply(character_goemetry.getStateSet()); and that's where it crashes. Is 
it legal to call state.apply in drawImplementation method ?

It crashes while drawing my custom Drawable in function drawImplementation() 
while rendering its content like this:

Code:

// for each glyph in CustomTextDrawable
for (int i = 0; i  itr-glyph-getNumDrawables(); ++i)
{
osg::Drawable* drawable = itr-glyph-getDrawable(i);

state.apply(drawable-getStateSet());

itr-glyph-getDrawable(i)-draw(renderInfo);
}




Stack trace:

Code:

msvcr90.dll!_crt_debugger_hook(int _Reserved=6676656)  Line 65  C
msvcr90.dll!_invoke_watson(const wchar_t * pszExpression=0x, const 
wchar_t * pszFunction=0x, const wchar_t * pszFile=0x, unsigned 
int nLine=0, unsigned int pReserved=0)  Line 230 + 0x7 bytes  C++
msvcr90.dll!_invalid_parameter_noinfo()  Line 125 + 0xc bytes   C++
osg80-osgrd.dll!std::_Treestd::_Tset_traitsosg::Program::PerContextProgram 
const *,std::lessosg::Program::PerContextProgram const 
*,std::allocatorosg::Program::PerContextProgram const *,0 
::const_iterator::_Inc()  Line 391 + 0x2 bytes  C++
osg80-osgrd.dll!std::_Distance2std::_Treestd::_Tset_traitsosg::Program::PerContextProgram
 const *,std::lessosg::Program::PerContextProgram const 
*,std::allocatorosg::Program::PerContextProgram const *,0 
::const_iterator,unsigned 
int(std::_Treestd::_Tset_traitsosg::Program::PerContextProgram const 
*,std::lessosg::Program::PerContextProgram const 
*,std::allocatorosg::Program::PerContextProgram const *,0 ::const_iterator 
_First=0x {_program=??? _extensions={...} _glProgramHandle=??? ...}, 
std::_Treestd::_Tset_traitsosg::Program::PerContextProgram const 
*,std::lessosg::Program::PerContextProgram const 
*,std::allocatorosg::Program::PerContextProgram const *,0 ::const_iterator 
_Last=0x0a4ecc80 {_program=??? _extensions=??? _glProgramHandle=??? ...}, 
unsigned int  _Off=5, std::bidirectional_iterator_tag __formal={...})  Line 
1859 + 0xb bytes   C++
osg80-osgrd.dll!std::_Treestd::_Tset_traitsosg::Program::PerContextProgram 
const *,std::lessosg::Program::PerContextProgram const 
*,std::allocatorosg::Program::PerContextProgram const *,0 ::count(const 
osg::Program::PerContextProgram * const  _Keyval=)  Line 999 C++
osg80-osgrd.dll!osg::State::setLastAppliedProgramObject(const 
osg::Program::PerContextProgram * program=0x006367c8)  Line 1257 + 0x17 bytes   
  C++
osg80-osgrd.dll!osg::Program::apply(osg::State  state={...})  Line 460 + 0x8 
bytes C++
osg80-osgrd.dll!osg::State::applyAttribute(const osg::StateAttribute * 
attribute=0x00624350, osg::State::AttributeStack  as={...})  Line 1598  C++
osg80-osgrd.dll!osg::State::applyAttributeList(std::mapstd::pairenum 
osg::StateAttribute::Type,unsigned 
int,osg::State::AttributeStack,std::lessstd::pairenum 
osg::StateAttribute::Type,unsigned int 
,std::allocatorstd::pairstd::pairenum osg::StateAttribute::Type,unsigned 
int const ,osg::State::AttributeStack
attributeMap=[10](((MATERIAL,0),{changed=false 
last_applied_attribute=0x088a6708 last_applied_shadercomponent=0x 
...}),((LIGHT,0),{changed=false last_applied_attribute=0x00654f60 
last_applied_shadercomponent=0x ...}),((POINT,0),{changed=false 
last_applied_attribute=0x097a9bd0 last_applied_shadercomponent=0x 
...}),...,...), const std::mapstd::pairenum 
osg::StateAttribute::Type,unsigned 
int,std::pairosg::ref_ptrosg::StateAttribute,unsigned 
int,std::lessstd::pairenum osg::StateAttribute::Type,unsigned int 
,std::allocatorstd::pairstd::pairenum osg::StateAttribute::Type,unsigned 
int const ,std::pairosg::ref_ptrosg::State
 Attribute,unsigned int 
attributeList=[1](((PROGRAM,0),({_ptr=0x00624350 },0  Line 2298 + 0xb bytes 
  C++
osg80-osgrd.dll!osg::State::apply(const osg::StateSet * dstate=0x059685c0)  
Line 512C++
MyApp.exe!MyApp::CustomTextDrawable::drawImplementation(osg::RenderInfo  
renderInfo={...})  Line 87C++
osg80-osgrd.dll!osg::Drawable::draw(osg::RenderInfo  renderInfo={...})  Line 
914 + 0xa bytes   C++
osg80-osgUtilrd.dll!osgUtil::RenderBin::drawImplementation(osg::RenderInfo  
renderInfo={...}, osgUtil::RenderLeaf *  previous=0x0a344880)  Line 460   C++
osg80-osgUtilrd.dll!osgUtil::RenderBin::drawImplementation(osg::RenderInfo  
renderInfo={...}, osgUtil::RenderLeaf *  previous=0x0a344880)  Line 509 + 0x37 
bytes  C++

[osg-users] dynamic multithreading problem

2012-10-02 Thread Filip Arlet
Hi,

in my app I change during event traversal scene graph.
I deep copy one par of graph mostly with one geode and it's drawables, but it 
can be a transform with few geodes and add it to scene.
using DrawThreadPerContext it will crash sometimes.
what will I have to do ? where do I have to put DYNAMIC ? I tried putting it on 
every drawable and stateset, but it didn't help. What I'm doing wrong, I don't 
think I understand object variance properly, because it crashes.
Thank you!

Cheers,
Filip

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





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


Re: [osg-users] dynamic multithreading problem

2012-10-02 Thread Robert Osfield
Hi Filip,

On 2 October 2012 13:10, Filip Arlet fili...@seznam.cz wrote:
 in my app I change during event traversal scene graph.
 I deep copy one par of graph mostly with one geode and it's drawables, but it 
 can be a transform with few geodes and add it to scene.
 using DrawThreadPerContext it will crash sometimes.
 what will I have to do ? where do I have to put DYNAMIC ? I tried putting it 
 on every drawable and stateset, but it didn't help. What I'm doing wrong, I 
 don't think I understand object variance properly, because it crashes.

Changing the scene graph during event traversal shouldn't be a problem
and shouldn't require you do set the Drawable and StateSet to DYNAMIC
unless you are modifying the contents of these objects.  The only area
that might be worth looking at is if the draw traversal is access the
parent lists of the Drawable and/or StateSet while these are being
modified by the event traversal.

There isn't anything further I can suggest bassed on so few details
about the actual crash.  Please run your application in a debugger and
get a strack trace.  Also considering using a thread debug tool.

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