Crash on load barrel.nxs

Senzin

30-09-2012 09:08:01

Windows 7 Pro SP1 x64
Dual AMD 6950s in Crossfire
VS 2012 (2010 toolset) with all updates from Windows Update (9/25/2012)
Ogre 1.8.1
PhysX 2.8.4.6
NxOgre 1.6
Critter (latest as of 9/25/2012)

I'm attempting to implement sample 102 by following 102.cpp. I'm actually adding it to my implementation of 101 which worked fine. Note that I'm doing this in a separate project, not one that is dependent on the sample browser.

The following code throws an exception:
mBarrelMesh = mMeshManager->load("ogre://General/barrel.nxs", "barrel");

The exception:
Could not open resource 'ogre://General/barrel.nxs
Reason: Protocol 'ogre' could not be found.


If I don't catch the exception and break on debug, I'm taken to line 82 of NxOgreResourceSystem.cpp:

Resource* ResourceSystem::open(const Path& path, Enums::ResourceAccess resource_access)
{

ResourceProtocol* protocol = mProtocols[path.getProtocolHash()];

if (protocol == 0)
{
StringStream error_message;
error_message << "Could not open resource '" << path.getString() << "\n"
<< "Reason: Protocol '" << path.getProtocol() << "' could not be found.";
NxOgre_ThrowException(IOException, error_message.str(), Classes::_MeshSerialiser); // ========== LINE 82 ==========
return 0;
}

return protocol->open(path, resource_access);
}


If I comment out this line, the cube from 101 loads just fine. If I change the resource name to something that doesn't exist, I get the exact same error. So I don't know if it's a path problem or a protocol problem. I've copy/pasted that line directly from the 102.cpp file from the sample to make sure I didn't have a typo. Sample 102 runs fine in the sample browser. Is there something loaded by the sample browser that is required to make this work?

betajaen

30-09-2012 21:37:10

It looks like you didn't register the 'ogre' protocol. Which allows NxOgre to use the Ogre's resource system;

NxOgre::ResourceSystem::getSingleton()->openProtocol(new Critter::OgreResourceProtocol());

Senzin

30-09-2012 22:02:09

Yes, that was it. Looks like I missed that line when going through 102.cpp. Since I was adding the code to my 101 implementation, I only skimmed the stuff at the top which I thought were the same initial start up steps to create the physics world. Thanks for the help.

betajaen

30-09-2012 22:33:17

No worries. ;)