Hi,
I'm trying to draw a quadric surface, which is modifying each frame, and I'm
getting a heap corruption error. I guess the problem is in calculating
function, or in update callback, but can't find it in the debugger.
Code:
void SurfaceCalculationThread::reCalculateSurface()
{
mutex.lock();
float x, y, z;
int i = 0;
float t=time->elapsedTime();
for (x = -polygonLength; x <= polygonLength; x += 1.0f)
{
for (y = -polygonLength; y <= polygonLength; y += 1.0f)
{
(*oldVertexArray)[i].set((*newVertexArray)[i]);
z = computeZ(x, y, t);
(*newVertexArray)[i].set(osg::Vec3f(x, y, z));
i++;
}
}
geometry->setVertexArray(oldVertexArray);
geometry->setUpdateCallback(new
UpdateSurfaceCallback(conditionVariable));
osgUtil::SmoothingVisitor *smoothingVisitor = new
osgUtil::SmoothingVisitor();
smoothingVisitor->smooth(*geometry);
smoothingVisitor->setName("normal");
conditionVariable->wait(&mutex);
mutex.unlock();
}
void UpdateSurfaceCallback::operator()(osg::Node *node, osg::NodeVisitor *nv)
{
traverse(node, nv);
conditionVariable->wakeAll();
};
Thanks for your help!
Cheers,
Julie
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65007#65007
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org