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++