Error creating the hydrax class

Gemberkoekje

18-09-2009 10:06:21

Hello,

I've been playing around with the hydrax demo, and now I'd like to get it into my own project. I have successfully gotten all the libraries and stuff compiled and starting, but when I start the debug project and try to initialize the Hydrax class
mHydrax = new Hydrax::Hydrax(m_SceneMgr, m_Camera, vp);
The exact break point is in Hydrax.cpp:
HydraxLOG("Hydrax created.");
on line 74.

I get the following error:
Unhandled exception at 0x00c4f690 in OgreWrapper_Debug.exe: 0xC0000005: Access violation reading location 0x00000024.

This Access violation has been reported before (here: http://www.ogre3d.org/forums/viewtopic. ... 25#p310660), but I haven't found an answer on how to solve it.

Help would be very nice :)

Thanks,

Gember

Gemberkoekje

18-09-2009 10:55:56

Some additional info:
Appearantly, the scenemanager and camera variables are somehow unexplainably lost in the progress:
In my init function:

In Hydrax.cpp:

Same with camera:

In Hydrax.cpp:

Gemberkoekje

18-09-2009 12:24:07

Ok, the weirdness in the pointers has been solved, problem was that I had compiled Hydrax.lib/dll in VS2005, and the project I'm using it in in VS2008.

However, it doesn't solve the initial problem, and I'm still getting the same access violation.

Gemberkoekje

18-09-2009 12:48:19

Disabling the Hydrax_log command takes me a little further, though that isn't the way it's supposed to work I guess.

However, it crashes on loadCFG(); I'd like to stress that it does not say 'file not exists', it goes into CFGfilemanager and crashes on this line:

if(!Ogre::ResourceGroupManager::getSingleton().resourceExists(HYDRAX_RESOURCE_GROUP, File))

It goes a bit deeper into string copying thingies, but that's not very informative.
The code used is the following


mHydrax = new Hydrax::Hydrax( m_SceneMgr, m_Camera, vp);

// Create our projected grid module
Hydrax::Module::ProjectedGrid *mModule
= new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
mHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*264 /*Generic one*/));

// Set our module
mHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));

// Load all parameters from config file
// Remarks: The config file must be in Hydrax resource group.
// All parameters can be set/updated directly by code(Like previous versions),
// but due to the high number of customizable parameters, Hydrax 0.4 allows save/load config files.
mHydrax->loadCfg("Tropical.hdx");

// Create water
mHydrax->create();

Gemberkoekje

22-09-2009 10:59:08

How such an annoying problem can have such an easy solution...

I was building my program in DEBUG, while the hydrax project used the RELEASE version of Ogre if not changed, even in debug.

Switch OgreMain to OgreMain_d -> All solved <3

I have another problem now, though, I've got a good UNDERWATER scene, but the water SURFACE doesn't seem to render.

The log file does give some exceptions:

11:51:44: [Hydrax] Creating underwater material...
11:51:44: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxDepthReflectionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at f:\codingextra\ogre\shoggoth_vc9\ogre\ogremain\src\ogreresourcegroupmanager.cpp (line 753)
11:51:44: Error loading texture HydraxDepthReflectionMap. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxDepthReflectionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at f:\codingextra\ogre\shoggoth_vc9\ogre\ogremain\src\ogreresourcegroupmanager.cpp (line 753)
11:51:44: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxDepthReflectionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at f:\codingextra\ogre\shoggoth_vc9\ogre\ogremain\src\ogreresourcegroupmanager.cpp (line 753)
11:51:44: Error loading texture HydraxDepthReflectionMap. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxDepthReflectionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at f:\codingextra\ogre\shoggoth_vc9\ogre\ogremain\src\ogreresourcegroupmanager.cpp (line 753)
11:51:44: Texture: UnderwaterDistortion.jpg: Loading 1 faces(PF_R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
11:51:44: [Hydrax] Underwater material created.


Not sure if this is the problem, but it's the only thing I could link to it.

db123

16-10-2009 14:09:56

:D my friend, I think you are link the hydrax lib error, for example, you import the OgreMain.lib in debug model. :D :D
whe? because I get this error,too. I find this resolution... O(∩_∩)O