[osg-users] osgUtil::Optimizer crash

0 views
Skip to first unread message

S.I.M. van Keulen

unread,
Apr 30, 2008, 9:12:15 AM4/30/08
to osg-...@lists.openscenegraph.org
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: *Se...@OrganicVectory.com
* 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
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
May 6, 2008, 11:14:06 AM5/6/08
to Se...@organicvectory.com, OpenSceneGraph Users
Hi Serge,

Which version of the OSG are you using? Which OS? In 2.3.x/2.4
there was a bug fix to Optimizer that might fix the problem you are
seeing.

Also any chance of you providing an example dataset?
Robert.

Reply all
Reply to author
Forward
0 new messages