Hello All,
I encountered a problem with osgUtil::Optimizer.
The merge of two Vec3 vertex arrays fails in:
optimizer.cpp: MergeArrayVisitor::_merge
The problem started when I changed the construction of a Geode from
having one Geometry to having several.
When I do not optimize there is no problem. Rendering is just fine. Also
no problems at shut-down and no memory leaks.
At first I suspected a memory management bug in my code, but I just
can't see it.
*This is roughly what I did before the problem:
*osg::Geode*
Construct(void)
{
osg::Geode* l_Geode = new osg::Geode;
osg::Geometry* l_Geometry = new osg::Geometry;
osg::Vec3Array* l_Vertices = new osg::Vec3Array;
l_Geometry->setVertexArray(l_Vertices);
for (..)
{
for (..)
{
l_Vertices->push_back(..);
l_Vertices->push_back(..);
l_Vertices->push_back(..);
l_Vertices->push_back(..);
l_Geometry->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::QUADS, l_Vertices.size()-4, 4));
}
}
l_Geode->addDrawable(l_Geometry);
return l_Geode;
}
*This is roughly what I do now, causing the problem:
*osg::Geode*
Construct(void)
{
osg::Geode* l_Geode = new osg::Geode;
osg::Geometry* l_Geometry = NULL;
osg::Vec3Array* l_Vertices = NULL;
for (..)
{
l_Geometry = new osg::Geometry;
l_Vertices = new osg::Vec3Array;
l_Geometry->setVertexArray(l_Vertices);
for (..)
{
l_Vertices->push_back(..);
l_Vertices->push_back(..);
l_Vertices->push_back(..);
l_Vertices->push_back(..);
l_Geometry->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::QUADS, l_Vertices.size()-4, 4));
}
l_Geode->addDrawable(l_Geometry);
}
return l_Geode;
}
I'm fairly new to OSG, so if someone could give me a pointer. That would
be much appreciated.
Serge
------------------------------------------------------------------------
Organic Vectory <http://www.OrganicVectory.com>
*
Email: [EMAIL PROTECTED]
* URL:* http://www.OrganicVectory.com
* Disclaimer*
"The information contained in this email is confidential and may contain
proprietary information. It is meant solely for the intended recipient.
Access to this email by anyone else is unauthorised. If you are not the
intended recipient, any disclosure, copying, distribution or any action
taken or omitted in reliance on this, is prohibited and may be unlawful.
No liability or responsibility is accepted if information or data is,
for whatever reason corrupted or does not reach its intended recipient.
No warranty is given that this email is free of viruses."
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org