Stack corruption in DebugDrawer

vcpaul

09-09-2011 10:57:03

Hi everyone,
I'm trying to introduce collision detection into my program using OgreBullet, but I've encountered two strange issues. The first is that whenever I instantiate a new DebugDrawer like this:

OgreBulletCollisions::DebugDrawer* debugDrawer = new OgreBulletCollisions::DebugDrawer();

Visual Studio 2010 complains that the stack around the variable redVisible was corrupted when leaving the DebugLines constructor. If I ignore the warning and carry on to try and create a collision shape from a mesh like this:

MeshManager::getSingleton().load(meshFile,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

Ogre::Entity* entity(sceneManager_->createEntity(meshFile));
node->attachObject(entity);

OgreBulletCollisions::StaticMeshToShapeConverter *converter =
new OgreBulletCollisions::StaticMeshToShapeConverter(entity);

OgreBulletCollisions::CollisionShape *collisionShape =
(OgreBulletCollisions::CollisionShape*)converter->createConvexDecomposition();


Then I get an access violation in VertexIndexToShape::addStaticVertexData on the call to createConvexDecomposition. I get the same problem with every mesh file I try, even very simple ones like the cube.mesh that ships in the Ogre samples directory.

Has anyone come across either of these issues before? I'm using VS2010, Ogre 1.72, Bullet 2.78 and OgreBullet rev 2985 from the trunk. If anyone could point me in the right direction I'd really appreciate it. Many thanks,

Paul