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=0x00000000, const 
wchar_t * pszFunction=0x00000000, const wchar_t * pszFile=0x00000000, 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::_Tree<std::_Tset_traits<osg::Program::PerContextProgram 
const *,std::less<osg::Program::PerContextProgram const 
*>,std::allocator<osg::Program::PerContextProgram const *>,0> 
>::const_iterator::_Inc()  Line 391 + 0x2 bytes      C++
osg80-osgrd.dll!std::_Distance2<std::_Tree<std::_Tset_traits<osg::Program::PerContextProgram
 const *,std::less<osg::Program::PerContextProgram const 
*>,std::allocator<osg::Program::PerContextProgram const *>,0> 
>::const_iterator,unsigned 
int>(std::_Tree<std::_Tset_traits<osg::Program::PerContextProgram const 
*,std::less<osg::Program::PerContextProgram const 
*>,std::allocator<osg::Program::PerContextProgram const *>,0> >::const_iterator 
_First=0x00000000 {_program=??? _extensions={...} _glProgramHandle=??? ...}, 
std::_Tree<std::_Tset_traits<osg::Program::PerContextProgram const 
*,std::less<osg::Program::PerContextProgram const 
*>,std::allocator<osg::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::_Tree<std::_Tset_traits<osg::Program::PerContextProgram 
const *,std::less<osg::Program::PerContextProgram const 
*>,std::allocator<osg::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::map<std::pair<enum 
osg::StateAttribute::Type,unsigned 
int>,osg::State::AttributeStack,std::less<std::pair<enum 
osg::StateAttribute::Type,unsigned int> 
>,std::allocator<std::pair<std::pair<enum osg::StateAttribute::Type,unsigned 
int> const ,osg::State::AttributeStack> > > & 
attributeMap=[10](((MATERIAL,0),{changed=false 
last_applied_attribute=0x088a6708 last_applied_shadercomponent=0x00000000 
...}),((LIGHT,0),{changed=false last_applied_attribute=0x00654f60 
last_applied_shadercomponent=0x00000000 ...}),((POINT,0),{changed=false 
last_applied_attribute=0x097a9bd0 last_applied_shadercomponent=0x00000000 
...}),...,...), const std::map<std::pair<enum 
osg::StateAttribute::Type,unsigned 
int>,std::pair<osg::ref_ptr<osg::StateAttribute>,unsigned 
int>,std::less<std::pair<enum osg::StateAttribute::Type,unsigned int> 
>,std::allocator<std::pair<std::pair<enum osg::StateAttribute::Type,unsigned 
int> const ,std::pair<osg::ref_ptr<osg::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 512    C++
MyApp.exe!MyApp::CustomTextDrawable::drawImplementation(osg::RenderInfo & 
renderInfo={...})  Line 87    C++
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++
osg80-osgUtilrd.dll!osgUtil::RenderStage::drawImplementation(osg::RenderInfo & 
renderInfo={...}, osgUtil::RenderLeaf * & previous=0x0a344880)  Line 1398       
 C++
osg80-osgUtilrd.dll!osgUtil::RenderStage::drawInner(osg::RenderInfo & 
renderInfo={...}, osgUtil::RenderLeaf * & previous=0x0a344880, bool & 
doCopyTexture=false)  Line 933      C++
osg80-osgUtilrd.dll!osgUtil::RenderStage::draw(osg::RenderInfo & 
renderInfo={...}, osgUtil::RenderLeaf * & previous=0x0a344880)  Line 1239      
C++
osg80-osgUtilrd.dll!osgUtil::SceneView::draw()  Line 1443 + 0x15 bytes  C++
osg80-osgrd.dll!osg::Timer::tick()  Line 61 + 0xa bytes C++
osg80-osgViewerrd.dll!osgViewer::Renderer::draw()  Line 726     C++
osg80-osgViewerrd.dll!osgViewer::Renderer::operator()(osg::GraphicsContext * 
context=0x006470d8)  Line 894      C++
osg80-osgrd.dll!osg::GraphicsContext::runOperations()  Line 756 + 0x12 bytes    
C++
osg80-osgrd.dll!osg::RunOperations::operator()(osg::GraphicsContext * 
context=0x006470d8)  Line 138     C++
osg80-osgrd.dll!osg::GraphicsOperation::operator()(osg::Object * 
object=0x006470d8)  Line 53 + 0xe bytes        C++
osg80-osgrd.dll!osg::OperationThread::run()  Line 429   C++
osg80-osgrd.dll!osg::GraphicsThread::run()  Line 41     C++     




Btw. I didn't noticed this behavior in SingleThreaded Mode and it crashes only 
when I'm copying subgraph (I'm also deep copying statesets in drawables, when 
they need to change attribute values) and I do it once, then attach it to scene 
and then destroy it afterwards.

Any ideas ?

Thank you!

Cheers,
Filip

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





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

Reply via email to