DragonL
26-01-2008 12:20:02
This plugin looks absolutely great, but I'm having trouble with it, so I hope someone here can help me out a little!
I set everything up pretty much like in the first tutorial (elected to use the addon code from cvs but compile it against the latest ogre sdk rather than ogre cvs), and it starts up just fine. It seems to work well while I just look at the forest from a distance, but if I move the camera in closer, it crashes. Stepping through the code reveals that the crash happens upon loading of a new page that comes into range.
This is what I do:
Here is where the crash happens (BatchedGeometry.cpp, line 360):
When leaving the for scope, std::list::~list() is called, and so I get the error: "Invalid Address specified to RtlValidateHeap( 003F0000, 04CF70F0 )"
I'm thinking it must be the list returned by findElementsBySource, so I checked that function declaration, and I'm not sure if it's relevant, but it says this:
I'm rather lost after trying to debug this for the past couple of hours, and I only just started using Ogre last week, so I hope one of you guys have an idea what might be wrong?
I set everything up pretty much like in the first tutorial (elected to use the addon code from cvs but compile it against the latest ogre sdk rather than ogre cvs), and it starts up just fine. It seems to work well while I just look at the forest from a distance, but if I move the camera in closer, it crashes. Stepping through the code reveals that the crash happens upon loading of a new page that comes into range.
This is what I do:
trees = new PagedGeometry(camera, 50);
trees->addDetailLevel<BatchPage>(400);
trees->addDetailLevel<ImpostorPage>(800, 100);
TreeLoader3D * treeLoader = new TreeLoader3D(trees, TBounds(0, 0, 1500, 1500));
trees->setPageLoader(treeLoader);
Entity * myTree = sceneMgr->createEntity("MyTree", "pine1.mesh");
for (int i = 0; i < 200; i++)
{
Radian yaw = Degree(Math::RangeRandom(0, 360));
Vector3 position;
position.x = Math::RangeRandom(0, 1500);
position.z = Math::RangeRandom(0, 1500);
position.y = 300;
Real scale = Math::RangeRandom(0.8f, 0.9f);
treeLoader->addTree(myTree, position, yaw, scale);
}
Here is where the crash happens (BatchedGeometry.cpp, line 360):
for (Ogre::ushort i = 0; i < vertBinding->getBufferCount(); ++i)
{
HardwareVertexBufferSharedPtr buffer = HardwareBufferManager::getSingleton()
.createVertexBuffer(vertDecl->getVertexSize(i), vertexData->vertexCount,
HardwareBuffer::HBU_STATIC_WRITE_ONLY);
vertBinding->setBinding(i, buffer);
vertexBuffers.push_back(static_cast<uchar*>(buffer->lock(HardwareBuffer::HBL_DISCARD)));
vertexBufferElements.push_back(vertDecl->findElementsBySource(i));
} // crash
When leaving the for scope, std::list::~list() is called, and so I get the error: "Invalid Address specified to RtlValidateHeap( 003F0000, 04CF70F0 )"
I'm thinking it must be the list returned by findElementsBySource, so I checked that function declaration, and I'm not sure if it's relevant, but it says this:
/** Gets a list of elements which use a given source.
@remarks
Note that the list of elements is returned by value therefore is separate from
the declaration as soon as this method returns.
*/
virtual VertexElementList findElementsBySource(unsigned short source);
I'm rather lost after trying to debug this for the past couple of hours, and I only just started using Ogre last week, so I hope one of you guys have an idea what might be wrong?