MogreNewt + Direct3D + parseScene method in release mode


29-07-2008 14:25:47

Hi there,

I hope this is the right place for this kind of question. I didn't find any post with a similar prob with this one so I've decided to post a new topic.

Well, now what matters. :)

I've been working in a project and I'm using Mogre and MogreNewt for the physics.

I have a scene (an indoor scene with 4 rooms and some furniture, nothing too fancy) and a Camera that uses a Body for collision detection.

Well, I've been working in Debug mode (it might help saying that I'm using VS2008 in Vista Business with SP1, DirectX SDK March 2008) for a while and every thing has been working fine.

I get the following exception (with the stack trace) when running the project in Release Mode using Direct3D Rendering System. It works perfectly in OpenGL in Release Mode.
In Debug Mode, it works in OpenGL and Direct3D.

System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
at NewtonTreeCollisionEndBuild(NewtonCollision* , Int32 )
at MogreNewt.CollisionPrimitives.TreeCollisionSceneParser.ParseScene(SceneNode startNode, Boolean optimize, FaceWinding fw)
at MogreNewt.CollisionPrimitives.TreeCollisionSceneParser.ParseScene(SceneNode startNode, Boolean optimize)
at ProjectoRV.States.Simulation.AddNewElementsToScene() in C:\Projects\Learning Mogre\ProjectoRV\States\Simulation.cs:line 84
at ProjectoRV.States.Simulation.Enter() in C:\Projects\Learning Mogre\ProjectoRV\States\Simulation.cs:line 33
at ProjectoRV.StateManager.ChangeState(Type state) in C:\Projects\Learning Mogre\ProjectoRV\StateManager.cs:line 77
at ProjectoRV.StateManager..ctor() in C:\Projects\Learning Mogre\ProjectoRV\StateManager.cs:line 26
at ProjectoRV.ProjectoRV.Main() in C:\Projects\Learning Mogre\ProjectoRV\ProjectoRV.cs:line 27
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

I've already tried to recompile MogreNewt, that didn't solve the problem.

I have the Newton.dll in both Debug and Release directories, from Newton Dynamics SDK v1.53.

The problem occurs with the MogreNewt.dll that I had compiled as well with the MogreNewt.dll that comes with the MogreSDK v1.4.8 (I've should mention it earlier probably... :) )

I really don't know where that problem could be.
I'm just posting this because someone could have been here before and maybe could help me.

btw, it might help... here's the code where I try to parse the scene.

TreeCollisionSceneParser stat_col = new TreeCollisionSceneParser( newtHandler.World );
stat_col.ParseScene( levelNode , true );
Body worldBody = new Body( newtHandler.World , stat_col );

Thank you in advance.

EDIT: It seems that doesn't work anymore in Debug Mode either in Direct3D... will try to reinstall the DirectX SDK

EDIT2: sorrys for the edits...
I've tried with and MogreNewton.dll that I had here (don't remember from where it came but has 556KB in size dated of 10-04-2008 (debug dll, probably one I've built myself))
I'm using the revision 243 from the MogreNewt svn (probably not for this last dll I've mentioned).


04-08-2008 10:43:14

this is sad.

After some tries (reinstalling the MogreSDK and the DirectX SDK) I've managed to solve my problem.

Thanks anyway.

EDIT: Well, it seems that on this last test where I thought it was working, I was not calling the ParseScene method.
So, I'm still stuck with this problem... If anyone has passed something similar and know what could cause this, thank you :)
sorry for all the confusion with the EDITs :P