[Bloody Mess] Loading in Triangle Mesh

Benjiro

17-06-2009 07:06:25

Hi Guys,

Im having trouble loading in a try mesh and rendering it too the screen


NxOgre::ResourceSystem::getSingleton()->openArchive("myLevel", "file:../media/NxObject");
mlevel = NxOgre::MeshManager::getSingleton()->load("myLevel:level.nxs");
mCube = mRenderSystem->createBody(new NxOgre::TriangleGeometry(mlevel), NxOgre::Real3(0,0,-500), "Cylinder04.mesh");


Compiles and runs by crashs with Unhandled exception at 0x03bf9116 in Framework.exe: 0xC0000005: Access violation reading location 0x00000008. its runs fine if i change TriangleGeometry to Convex

spacegaier

19-06-2009 22:51:12

Well, your code looks fine and using TriangleGeometry works for me.

The only possible problem that comes to my mind is the file path (but as you said that it works with Convexes that would be strange). However, wrong filepaths will cause runtime errors at loading time.

Either try using an abosulute path or if media is a subfolder of the folder your exe is in, use:
NxOgre::ResourceSystem::getSingleton()->openArchive("myLevel", "file:media/NxObject");

spacegaier

21-06-2009 20:10:04

Ah, I know now where your error comes from:
Your level.nxs is a ConvexMesh file and therefore it crashes when used as a TriangleMesh file.

So, pass your level.mesh (or whatever it is called) to Flour again like this:

flour convert in:level.mesh, into:triangle, out:level_triangle.nxs
Then try your code again with the new file.

Benjiro

22-06-2009 03:29:08

Thanks for the Help!

The problem was is i had a triangle mesh with the wrong extension and convex with the right extension. All working now! Thanks again