Hydrax is not updating


08-08-2009 17:15:44

Hi guys,

I have a strange problem, maybe someone of you knows what the problem might be:

In my Scene I have a Hydrax surface, which works perfectly in Visual Studio C++ 2008 in Debug and Release mode by pressing F5. However, If I launch the release application by doubleclicking on the .exe file in the explorer, my skybox is not visible until I move the camera for the first time. Funny thing is that it works in Debug mode, so I guess that it is some kind of optimization problem.
Has anybody ever had such a strange problem?

NB: The starting position of my camera is underwater.
NB2: I can move the mouse (change the camera's lookAt) but it still doesn't work until I move the camera's position, from then on it works perfectly.

Here are two screenshots:

Running in Release or Debug mode from VC++ or running debug mode from explorer:

Running Release mode from explorer:

Relevant Code:

// Setup scene
mSceneMgr->setSkyBox(true, "Sky/EarlyMorning", 10000.0f);
mCamera->setPosition(0.0f, 0.0f, 0.0f);
mCamera->lookAt(0.0f, 0.0f, -3000.0f);
Ogre::Vector3 mSunPosition = Ogre::Vector3(-1000.0f, 500.0f, -2000.0f);
Ogre::Vector3 mSunColor = Ogre::Vector3(1,0.6,0.4);

// Light
Ogre::Light *mLight = mSceneMgr->createLight("Sun");
mLight->setDiffuseColour(1, 1, 1);
mLight->setSpecularColour(mSunColor.x, mSunColor.y, mSunColor.z);

// hydrax
// Create Hydrax object
hydrax = new Hydrax::Hydrax(mSceneMgr, mCamera, mWindow->getViewport(0));

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

// Set our module

// 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.

// Create water

// update
bool GameEngine::frameStarted(const FrameEvent& evt) {


08-08-2009 18:46:25

This seems like any kind of little bug in Hydrax, I'll check it!

P.D.: I'm on holidays and I haven't my PC so it will take some time :(


08-08-2009 19:26:42

Hi Xavyiy

Thank you for your quick reply. Enjoy your holidays, that issue is not that important.

As it works in Debug mode, I strongly suspect it's some optimization or multithreading problem, but you know that much better than me...


10-08-2009 10:20:36

Hi again, Xavyiy!

I've already read that the Hydrax destructors are not really up-to-date at the moment, that's OK I guess as normal users will only need to unload the scene once.
As for my application, I'm having two scenes (Two cameras, two SceneManagers) which both have two hydrax objects. If I only load one scene, everything works properly, but as soon as I try to unload one (delete hydrax object) and load the other scene, I get this error (ogre.log):

11:30:55: [Hydrax] Hydrax created.
11:30:55: [Hydrax] HydraxDemo.hdx loaded.
11:30:55: [Hydrax] Error in bool MaterialManager::createGpuProgram(): _Hydrax_GodRays_VP exists.
11:30:55: OGRE EXCEPTION(2:InvalidParametersException): This pass does not have a vertex program assigned! in Pass::getVertexProgramParameters at f:\codingextra\ogre\shoggoth_vc9\ogre\ogremain\src\ogrepass.cpp (line 1325)

I suspect that when unload hydrax the god rays are not properly destroyed. Could that be? In which order do I need to unload hydrax anyways? I'm currently doing it that way:

if (hydrax) delete hydrax;
if (mSceneMgr) delete mSceneMgr;

, whereas hydrax is a Hydrax::Hydrax object.

It would be great if you could tell me whether I'm unloading hydrax wrong or if there really could be a problem in the hydrax destructor(s). If so, maybe I can identify the problem further and fix it in the hydrax code.