Mogre & PLSM2?

J250

29-03-2009 18:23:49

Hello,
Firstly, a big thanks to all those who have worked on Mogre, Ogre and PLSM in the first place.

Ok, I have a few questions/queries about using PLSM2 in Mogre.
I have read a lot, googled, wikied, and searched the forums to the best of my ability, and I apologize if the answer to these questions are extremely obvious, I just havn't managed to find the solution myself.

Firstly, is it possible? I have read a lot, and as far as I know it is, as long as you compile PLSM with Mogre references (include and lib directories)
Is that correct?
If anyone has a prebuilt binary dll (compiled with Mogre!) that works, can you please upload it or something? because that may instantly solve the problem!

I shall tell you the process I used completely, because it may help in understanding the cause of the problem.
Firstly, I got the latest svn version of PLSM2 - source ( I had used (stupidly) previous versions before, which caused frustrations)
I opened the SDK solution (after the others didnt work) and changed the dependencies and locations, to the mogre ones.
I then noticed it needed the OctreeSceneManager files too, so I got those from the Ogre SVN, and added its include directory to the PLSM project references.
Now, it almost built, except for one line, which was something like this:

LogManager::getSingleton().logMessgae(CRITICAL,"Message about materials which I cant remember");

well, I read up on this, and found out that it had changed in some ogre revision or something. It seems it only logs an error, and because I was fed up of dead ends, I took the quick fix route of commenting it.
After a build, it worked fine! Well, built successfully.
I put the correct line in my plugins.cfg (obvious..)
and then I changed the scene manager type to:

mSceneManager = mRoot.CreateSceneManager("PagingLandScapeSceneManager");

Using the non-Mogre built version this line caused an error, and to my joy it worked fine. Now, other problems start to spring up.
I have located the error to a few lines.
mViewport = mWindow.AddViewport(mCamera);

Adding a camera is fine, but as soon as a viewport is addedwith the camera, the error occurs.
The error (I think) only triggers when the render loop is started, so the code initially executes fine.
What happens is the application triggers a breakpoint at the line : (something that has never happened in my applications before)
PLSM2_ASSERT(mPageManager);

Which is part of this snippet, in: OgrePagingLandScapeSceneManager.cpp

void PagingLandScapeSceneManager::_updateSceneGraph(Camera * cam)
{
// entry into here could come before setWorldGeometry
// got called which could be disastrous
// so check for init
PLSM2_ASSERT(mPageManager);
if (isRenderQueueToBeProcessed(mPageManager->getPageRenderQueue()))
{
if (mWorldGeomIsInit)
{
mPageManager->updatePaging (static_cast<PagingLandScapeCamera *> (cam));
}
else
{
if (mWorldGeomIsSetup)
{
mOptions->calculateCFactor ();
PLSM2_ASSERT (mPageManager);
if (mOptions->BigImage)
{
PLSM2_ASSERT (mTextureManager);

mTextureManager->setMapMaterial();
mPageManager->setMapMaterial();
}
mWorldGeomIsInit = true;
mPageManager->updatePaging (static_cast<PagingLandScapeCamera *> (cam));
}
}
}
// Call the default
#ifndef _PLSM_OCTREE
OctreeSceneManager::_updateSceneGraph(cam);
#else //_PLSM_OCTREE
PagingLandScapeOctreeSceneManager::_updateSceneGraph(cam);
#endif //_PLSM_OCTREE
}

When I step through the code, it gets to this line (I think):
if (isRenderQueueToBeProcessed(mPageManager->getPageRenderQueue()))

Then triggers the next error:
First-chance exception at 0x09a69824 (Plugin_PagingLandScapeSceneManager2.dll) in StayAliveEditor.exe: 0xC0000005: Access violation reading location

(The output window shown below.)

*************.exe has triggered a breakpoint
First-chance exception at 0x09a69824 (Plugin_PagingLandScapeSceneManager2.dll) in ***********.exe: 0xC0000005: Access violation reading location 0x00000140.
Step into: Stepping over non-user code 'System.Environment.GetResourceStringLocal'
Step into: Stepping over non-user code 'System.AccessViolationException.AccessViolationException'
A first chance exception of type 'System.AccessViolationException' occurred in Mogre.dll

Which when caught, produces this:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Now, where have I gone wrong if at all?

Again, if anyone has pre-built .dll's of this plugin (and Paged Geometry if possible!) that works,
as well as some form of instructions on how to use it correctly (if I am not already) I will be extremely thankful!

P.S. I hope this goes in the Mogre forum, as it is more MOGRE related, if not, sorry!
Again, any help greatly appreciated.
Thanks,
J250