Recreating Caelum system is impossible!

ahmadi

08-01-2009 13:16:27

Hi
I want recreate Caelum system in my project, the result is same as the following lines:
cs *t=New cs();
...
delete cs;
cs *t=New cs(); //Here is have error


The error is :"OGRE EXCEPTION (-1:UnsupportedException): Can't load point startfield material in PointStarField at .\src\PointStartfield.cpp(line 47)";
I don't know how can i solve the error!
Note1: if my sky don't use StarField then i haven't the error but the project will stop with a memory error "Pure function call!".
Note2: all of my project setting is correct, because i have no problem with Caelum when i don't want to recreate it.

Thanks for any help

cdleonard

08-01-2009 18:52:04

Recreating CaelumSystem is known to work; in fact the reset button in CaelumLab does just that.

It's strange that creating the starfield works first but fails the second time; it makes me suspect resource problems. Are you by any chance also reloading resources somehow? Posting the full ogre.log would help.

ahmadi

09-01-2009 08:07:39

Im sure that loaded all of resources before recreating Caelum system, but also i have the error , Here is my log:
Note: Other my scene stuffs work correct with recreating except Caelum
...Deleted by owner...

cdleonard

09-01-2009 10:16:49

I'm sorry; there is indeed a bug about this in Caelum 0.3: The starfield material is removed when PointStarfield is destroyed.

I added a tiny fix in 0.3 svn which clones the material for private use first (and thus makes removal legitimate). Trunk is not affected.

As a workaround I think you can completely destroy instead of merely unloading the "myGroup" resource group. That would force a (slow) reparse and redefinition of all materials.

ahmadi

10-01-2009 11:11:24

I'm sorry; there is indeed a bug about this in Caelum 0.3: The starfield material is removed when PointStarfield is destroyed.

I added a tiny fix in 0.3 svn which clones the material for private use first (and thus makes removal legitimate). Trunk is not affected.

As a workaround I think you can completely destroy instead of merely unloading the "myGroup" resource group. That would force a (slow) reparse and redefinition of all materials.

Thanks,
The error solved, but a new error occured as i said before (Error R6025)

cdleonard

10-01-2009 14:02:28

For that R6025 error you should try to run your program in debug mode and get a callstack for that message box; it should contain the offending call. I've never seen Caelum throw such an error before and I can't help you without a callstack.

ahmadi

14-01-2009 09:07:33

For that R6025 error you should try to run your program in debug mode and get a callstack for that message box; it should contain the offending call. I've never seen Caelum throw such an error before and I can't help you without a callstack.
In debug mode,The following error appeared on screen, also Visual Studio don't show anythings more in the callstack!


See also my log file:
...12:26:14: Caelum: Initialising Caelum system...
12:26:14: Creating resource group Caelum
12:26:14: Caelum: Created resource group (Caelum)
12:26:14: Caelum: System attributes set up.
12:26:14: Texture: EarthClearSky2.png: Loading 1 faces(PF_A8R8G8B8,64x64x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,64x64x1.
12:26:14: Texture: AtmosphereDepth.png: Loading 1 faces(PF_R8G8B8,32x1x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,32x1x1.
12:26:14: Caelum: Creating CaelumSphericDome sphere mesh resource...
12:26:14: Caelum: generateSphericDome DONE
12:26:14: Texture: sun_disc.png: Loading 1 faces(PF_A8R8G8B8,128x128x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,128x128x1.
12:26:14: D3D9 : Loading 2D Texture, image name : 'moon_disc.dds' with 5 mip map levels
12:26:14: Texture: noise1.png: Loading 1 faces(PF_R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
12:26:14: Texture: noise2.png: Loading 1 faces(PF_R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
12:26:14: Texture: noise3.png: Loading 1 faces(PF_R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
12:26:14: Texture: noise4.png: Loading 1 faces(PF_R8G8B8,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
12:26:14: Caelum: DONE initializing
12:26:14: Mesh: Loading sphere.mesh.
12:26:15: Caelum: Recomputing starfield geometry.
12:26:15: OGRE EXCEPTION(2:InvalidParametersException): Parameter called sunDirection does not exist. in GpuProgramParameters::_findNamedConstantDefinition at e:\ogre source\ogre\ogremain\src\ogregpuprogram.cpp (line 1097)

cdleonard, What is "sunDirection" parameter and Do you know how can i solve the error?

cdleonard

17-01-2009 06:35:04

In debug mode,The following error appeared on screen, also Visual Studio don't show anythings more in the callstack!

What happened in there is that an exception was thrown from Ogre; through Caelum and was caught somewhere in main and displayed in a message box. At this point the original callstack is lost. In java/C# exceptions get a copy of their callstack at the point of throwing and can later display it; this doesn't happen in native C++.

You can force VisualStudio to break into the debugger when an exception is thrown. This way you can see detailed information about how the exception happened. There is a dialog for this: Debug->Exceptions. Just make it break on all C++ exceptions. Then you can give a detailed callstack about how that last exception was thrown

Ogre can also throw non-fatal exceptions in normal use; those are not interesting here. You can run the whole thing through the debugger and hit "continue" for all the non-fatal exception along the way. Or you can change that setting in Debug->Exceptions just before you hit reload. Note: the program must be stopped to change exception settings. You can break into the debugger at any time with Debug->Break All.

Debugging is fun!

Anyway; about your sunDirection problem: I peered over the code in release 0.3 and I can't figure out how it can happen. More information can help.

ahmadi

17-01-2009 16:01:35

Thanks, im success to catch the Call Stack, and I hope the following screenshot help you to find the problem origin:



Here is text format of the Call Stack :
kernel32.dll!7707f35f()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
kernel32.dll!7707f35f()
msvcr90d.dll!_CxxThrowException(void * pExceptionObject=0x0017edc8, const _s__ThrowInfo * pThrowInfo=0x1189e1f0) Line 161 C++
> OgreMain_d.dll!Ogre::GpuProgramParameters::_findNamedConstantDefinition(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name="sunDirection", bool throwExceptionIfNotFound=true) Line 1097 + 0xde bytes C++
OgreMain_d.dll!Ogre::GpuProgramParameters::setNamedConstant(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name="sunDirection", const Ogre::Vector3 & vec={...}) Line 1836 + 0x1c bytes C++
caelum_d.dll!005e1360()
caelum_d.dll!005bde23()
caelum_d.dll!005bd80d()
OgreMain_d.dll!Ogre::Root::_fireFrameStarted(Ogre::FrameEvent & evt={...}) Line 679 + 0x28 bytes C++
OgreMain_d.dll!Ogre::Root::_fireFrameStarted() Line 752 C++
OgreMain_d.dll!Ogre::Root::renderOneFrame() Line 836 + 0x8 bytes C++
OgreMain_d.dll!Ogre::Root::startRendering() Line 829 + 0x8 bytes C++
p1.exe!ATOgreApplication::go() Line 248 + 0xe bytes C++
p1.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x006b59f7, HINSTANCE__ * __formal=0x00000000) Line 11 + 0xb bytes C++
p1.exe!__tmainCRTStartup() Line 574 + 0x35 bytes C
p1.exe!WinMainCRTStartup() Line 399 C
kernel32.dll!770de3f3()
ntdll.dll!7757cfed()
ntdll.dll!7757d1ff()

cdleonard

20-01-2009 07:01:01

You also need caelum_d.pdb to be available in order to generate a proper callstack. It should be build together with the rest of caelum; you should probably copy it together with caelum_d.dll.

Caelum 0.4 was branched yesterday; you might have better luck with it. There are a lot of additional fixes in that version.