| Author |
Message
|
| syedhs |
Posted: Mon Jul 26, 2010 12:09 pm Post subject: [SOLVED] Probably a stupid error... |
|
|
Joined: 10 Feb 2007 Posts: 10
|
but I just can't figure out.
I have done the Ogre integration using the code in the downloaded OgreGrome kit. I just cannot load the scene, it gives the error -12 for every single line below:-
| Code: |
gte::t_error result;
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone25.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone26.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone27.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone28.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone29.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone30.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone31.tzone"));
result = mGraphite->loadTerrainZone(M_SZ("./scene/industrial"), M_SZ("TerrainZone32.tzone"));
|
I have made sure that ./scene/industrial does exist and the app runs on the right path. And it is the same industrialbuilding sample file in the OgreGrome kit. The terrain material "GraphiteTerrainZone" is also in the resource (but in different file but I make sure it loaded properly).
I can't help but wondering, is it because of license or something? Or is there anything you can point out which is not that obvious (I hope).[/code]
Last edited by syedhs on Wed Jul 28, 2010 9:21 am; edited 2 times in total |
|
| Back to top |
|
 |
| ALicu |
Posted: Mon Jul 26, 2010 1:07 pm Post subject: |
|
|
Joined: 12 Feb 2007 Posts: 974
|
Hi,
Error code -12 is C_STOR_OPEN_ERR which means that the files were not found. What I've found out is that when running in Visual Studio debug mode you need to put the exe file's output directory as the Working Directory (from project properties, in the Debugging you choose the same path as the exe output path in the Working Directory entry). I suspect that your current directory is not the same as the exe location when running the program in visual studio.
So in your case, if your exe output folder is for example c:\my_application, then put this as Working Directory and have your scene in c:\my_application\scene\industrial.
Let me know if this fixes the issue.
Regards,
Adrian L. |
|
| Back to top |
|
 |
| syedhs |
Posted: Mon Jul 26, 2010 4:11 pm Post subject: |
|
|
Joined: 10 Feb 2007 Posts: 10
|
| I have already set the path correctly in the debugging tab. I even tried running it directly (outside IDE) but still the same error. |
|
| Back to top |
|
 |
| syedhs |
Posted: Tue Jul 27, 2010 6:14 am Post subject: |
|
|
Joined: 10 Feb 2007 Posts: 10
|
It seems that the graphite.dll is statically linked to all VC runtime dlls, and mine is dynamically linked . Probably having my app compiled the same as OgreGraphite (statically linked to runtime DLL) will solve it.
The reason is I used a utility called filemon to track all the file activities done by my app and when it executes the problematic line which I narrow it down to
| Code: |
if(M_FAILED(ret_code = zone->Load(NULL, (void*)complete_path.Sz())))
|
complete_path appear to have been corrupted. It could be the problem when string travel across DLL boundaries which is compiled differently.
FYI I am statically linked to Ogre. I will recompile everything and see how it goes...
Edit: It doesn't solve it. |
|
| Back to top |
|
 |
| syedhs |
Posted: Tue Jul 27, 2010 2:05 pm Post subject: |
|
|
Joined: 10 Feb 2007 Posts: 10
|
I think it has to do with Ogre's Memory Allocator - but I am not sure on how to configure the project setting to fix that. Btw, I am using latest Ogre 1.8 trunk.
But there is one thing I can do: probably I will try to implement iIOInterface which wil be passed as 1st parameter to iTerrainZone::Load. That way, I will handle the file loading/reading myself so I hope it will fix the error. |
|
| Back to top |
|
 |
| ALicu |
Posted: Tue Jul 27, 2010 2:23 pm Post subject: |
|
|
Joined: 12 Feb 2007 Posts: 974
|
Hi,
| Quote: |
| complete_path appear to have been corrupted. It could be the problem when string travel across DLL boundaries which is compiled differently. |
So basically after zone->Load call, does the complete_path reaches the file load function modified?
This is strange. The viewer application that comes with the OgreGraphite integration as a sample is dynamically linking to the multi-threaded runtime DLL, not statically. It is using Visual Studio 2005, same as Graphite dll. In case you are using newer Visual Studio I may see problems there.
Regards,
Adrian L. |
|
| Back to top |
|
 |
| syedhs |
Posted: Tue Jul 27, 2010 2:27 pm Post subject: |
|
|
Joined: 10 Feb 2007 Posts: 10
|
Yes that was strange.
The difference between mine & viewer is mine is statically linked to Ogre 1.8 (viewer was 1.6.x I think). Mine is compiled in VS2005 Pro. |
|
| Back to top |
|
 |
| syedhs |
Posted: Wed Jul 28, 2010 9:20 am Post subject: |
|
|
Joined: 10 Feb 2007 Posts: 10
|
Okay finally solve it. Apparently I use the graphite.dll which was from the demo (OgreCrome). As soon as I replaced the one from the registered one, it functions okay.
Probably you can somehow add version feature to ensure that the one you dynamically loading is the one you thought is - just an idea. |
|
| Back to top |
|
 |
| ALicu |
Posted: Wed Jul 28, 2010 9:30 am Post subject: |
|
|
Joined: 12 Feb 2007 Posts: 974
|
Hi,
I think that both should work (I will check that). What build are using, with UNICODE or ASCII character set?
Regards,
Adrian L. |
|
| Back to top |
|
 |
| syedhs |
Posted: Wed Jul 28, 2010 9:42 am Post subject: |
|
|
Joined: 10 Feb 2007 Posts: 10
|
|
| Back to top |
|
 |
| ALicu |
Posted: Thu Jul 29, 2010 8:27 am Post subject: |
|
|
Joined: 12 Feb 2007 Posts: 974
|
| Hmm, the OgreGrome demo has the ASCII Graphite and it should work. When you said the registered one are you referring to the one from the client account (accessed from Available Services after you login from the site main page)? |
|
| Back to top |
|
 |
|
|