[SOLVED] Stuck on create workspace

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Alessan
Gnoblar
Posts: 6
Joined: Tue Jul 15, 2014 12:17 am
x 1

[SOLVED] Stuck on create workspace

Post by Alessan »

Hi,
Today I download the last svn.
I read the code of ExampleApplication to see how setup an empty scene but I'm stuck creating a workspace:

Code: Select all

An exception has occurred: OGRE EXCEPTION(5:ItemIdentityException): Workspace definition '[Hash 0x00000001]' not found in CompositorManager2::addWorkspace at /home/main/Workspace/libs/ogre/OgreMain/src/Compositor/OgreCompositorManager2.cpp (line 362)
Then i read http://www.ogre3d.org/forums/viewtopic.php?f=25&t=80008 but don't work for me.
I can run sampleBrowser result of installation, but if I create an empty proyect and add SampleBrowser.h and SampleBrowser.cpp give me the same exception, always [Hash 0x00000001] even i change the definitionName ¿Hash not working?

SampleBrowser.h:

Code: Select all

Ogre::CompositorManager2 *compositorManager = mRoot->getCompositorManager2();
            if( !compositorManager->hasWorkspaceDefinition( "SampleBrowserWorkspace" ) )
            {
                compositorManager->createBasicWorkspaceDef( "SampleBrowserWorkspace",
                                                            Ogre::ColourValue( 0.6f, 0.0f, 0.6f ),
                                                            Ogre::IdString() );
            }
            compositorManager->addWorkspace( sm, mWindow, cam,
                                            "SampleBrowserWorkspace", true );
BaseApplication.h:

Code: Select all

void BaseApplication::createCompositor(void)
{
	mRoot->initialiseCompositor();
	Ogre::CompositorManager2* pCompositorManager = mRoot->getCompositorManager2();
	const Ogre::IdString workspaceName = "scene workspace";
	pCompositorManager->createBasicWorkspaceDef(workspaceName, Ogre::ColourValue::Black);
	pCompositorManager->addWorkspace(mSceneMgr, mWindow, mCamera, workspaceName, true);
}
someone can help me out?
Thanks.

Usign Netbeans on Xubuntu 14.04
Last edited by Alessan on Tue Jul 22, 2014 7:05 am, edited 1 time in total.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Stuck on create workspace

Post by al2950 »

I think the following post will help;
http://ogre3d.org/forums/viewtopic.php?f=25&t=80008
Alessan
Gnoblar
Posts: 6
Joined: Tue Jul 15, 2014 12:17 am
x 1

Re: Stuck on create workspace

Post by Alessan »

Thanks for reply,
As I say that link dont help me, I'm using Idstrings not Strings.

Debugging:
Image
imagen
Next step (on enter in addWorkspace):
Image
subir imagenes gratis

I dont know what happend, value is reseted.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Stuck on create workspace

Post by dark_sylinc »

A value of hash = 1 looks wrong because it's extremely unlikely that a string hashes to such value.

Looks like it could be memory corruption, or you've mixed Release with Debug builds, or using different C++ compile flags. Try recompiling everything.
If this is a debug build, then you're doing something wrong, because you shouldn't see [Hash = 0x00000001] but rather the actual string (you will see this format in Release builds, not Debug)

My guess Ogre is being compiled with "NDEBUG" defined while your code is not (or viceversa).

I suggest that, after running CMake on Ogre's source directory; when executing make; execute "make VERBOSE=1" which will show you the full command line used for compilation; and thus you will be able to compare the macros being defined (look for all the parameters starting with -D, i.e. -DNDEBUG -DDEBUG -DMY_WHATEVER_MACRO, etc)

If it's memory corruption, I would place the breakpoint right after that const Ogre::IdString workspaceName = "scene workspace"; line, get the address using gdb (type "p &workspaceName.mHash" no quotes) and then place a hardware write-memory breakpoint on the address (type "watch 0x12345678" no quotes, where 0x12345678 is the address of the variable). If there's a memory corruption going on, the debugger will break to notify you when the value is being overwriten with something else.

Edit: By default on Linux, CMake builds RelWithDebInfo. For a full debug, change CMAKE_CONFIGURATION_TYPES to "Debug".
I usually have two folders, one for Release and one for Debug. It's a shame CMake doesn't try to mimic the Windows' port on this (create and compile multiple build configurations at the same time)
Alessan
Gnoblar
Posts: 6
Joined: Tue Jul 15, 2014 12:17 am
x 1

Re: Stuck on create workspace

Post by Alessan »

Thanks for reply,

Solved. Changing CMAKE_BUILD_TYPE to 'Debug' Works.

Thanks again!.

P.D.: I had to apply a little old patch for my old cheap graphic card (OpenGL 1.3, glBlendEquation() segfault): http://www.ogre3d.org/forums/viewtopic.php?f=2&t=46865
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: [SOLVED] Stuck on create workspace

Post by scrawl »

My guess Ogre is being compiled with "NDEBUG" defined while your code is not (or viceversa).
Mixing debug libraries with release applications is known to cause problems on Windows, but not on Linux as the OP is using. To me it sounds like this is caused by Ogre using NDEBUG in its headers somewhere, and that is a bug! It should really be using OGRE_DEBUG_MODE, which is guaranteed to be consistent, no matter what the application that uses Ogre is compiled with.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: [SOLVED] Stuck on create workspace

Post by scrawl »

Just done a quick grep on the v2-0 codebase. There are plenty of #ifdef NDEBUG uses in headers, which as I explained is a bug.

https://bitbucket.org/sinbad/ogre/src/8 ... 2-0#cl-116

Full list:

Code: Select all

./OgreMain/include/OgreIdString.h:#ifdef NDEBUG
./OgreMain/include/OgreIdString.h:        In non-release modes (NDEBUG is not defined), IdStrings try to maintain a copy of
./OgreMain/include/OgreIdString.h:#ifndef NDEBUG
./OgreMain/include/OgreIdString.h:#ifndef NDEBUG
./OgreMain/include/OgreIdString.h:#ifndef NDEBUG
./OgreMain/include/OgreIdString.h:#ifndef NDEBUG
./OgreMain/include/OgreIdString.h:#ifndef NDEBUG
./OgreMain/include/OgreIdString.h:#ifndef NDEBUG
./OgreMain/include/Animation/OgreBone.h:#ifndef NDEBUG
./OgreMain/include/Animation/OgreBone.h:#ifndef NDEBUG
./OgreMain/include/Animation/OgreBone.inl:#ifndef NDEBUG
./OgreMain/include/OgreInstanceManager.h:#ifndef NDEBUG
./OgreMain/include/Math/Array/OgreObjectData.h:#ifndef NDEBUG
./OgreMain/include/Math/Array/SSE2/Single/OgreMathlibSSE2.h:#ifndef  NDEBUG
./OgreMain/include/Math/Array/SSE2/Single/OgreArrayVector3.inl:#ifdef NDEBUG
./OgreMain/include/Math/Array/NEON/Single/OgreMathlibNEON.h:#ifndef  NDEBUG
./OgreMain/include/Math/Array/NEON/Single/OgreArrayVector3.inl:#ifdef NDEBUG
./OgreMain/include/Math/Array/C/OgreArrayVector3.inl:#ifdef NDEBUG
./OgreMain/include/Math/Array/C/OgreMathlibC.h:#ifndef  NDEBUG
./OgreMain/include/OgreMovableObject.inl:#ifndef NDEBUG
./OgreMain/include/OgreSceneNode.h:#ifndef NDEBUG
./OgreMain/include/OgreMovableObject.h:#ifndef NDEBUG
./OgreMain/include/OgreMovableObject.h:#ifndef NDEBUG
./OgreMain/include/OgreNode.h:#ifndef NDEBUG
./OgreMain/include/OgreNode.h:#ifndef NDEBUG
You should change them all to use OGRE_DEBUG_MODE instead.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [SOLVED] Stuck on create workspace

Post by dark_sylinc »

No, it's not the same.

NDEBUG disables standard asserts and may even be left undefined in release builds to keep asserts on. OGRE_DEBUG_MODE is not used in release builds.
We assert some conditions where we need extra variables to get the assert to actually work or compile.

The problem that happened here is that the user mixed libraries with missmatching compile arguments; which is bound to crash no matter what macro or strategy is being used.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: [SOLVED] Stuck on create workspace

Post by scrawl »

Well, whatever you call it, it's still a bug. Previous Ogre versions allow using Debug ogre libraries with a Release application just fine. But 2.0 conditionally uses NDEBUG to determine the size of some classes/structs in a header, so now you've essentially forced all Ogre applications to use the same NDEBUG setting that Ogre does. That's just unnecessary and wrong.
OGRE_DEBUG_MODE and OGRE_ASSERT_MODE were introduced exactly for this problem. The values are written to OgreConfig.h, so that they stay the same regardless of the application's compile settings.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [SOLVED] Stuck on create workspace

Post by dark_sylinc »

scrawl wrote:But 2.0 conditionally uses NDEBUG to determine the size of some classes/structs in a header, so now you've essentially forced all Ogre applications to use the same NDEBUG setting that Ogre does. That's just unnecessary and wrong.
OGRE_DEBUG_MODE and OGRE_ASSERT_MODE were introduced exactly for this problem. The values are written to OgreConfig.h, so that they stay the same regardless of the application's compile settings.
Fair enough. But I won't fix it ASAP. Unfortunately this requires some CMake kung-fu to ensure the checks always stay in Debug and RelWithDebInfo configs, but get disabled in Release builds of Ogre;
and neither OGRE_DEBUG_MODE nor OGRE_ASSERT_MODE satisfy this criteria.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: [SOLVED] Stuck on create workspace

Post by scrawl »

Based on a quick test on Ubuntu 14.04, I see the following with GCC (used VERBOSE=1 make to see compiler flags):
- Release -O3 -DNDEBUG
- RelWithDebInfo -O2 -g -DNDEBUG
- Debug -g

Here's a link to a cmake commit that enabled -DNDEBUG for RelWithDebInfo builds. Perhaps you are using an older version?

Anyway, as far as I can tell, this means the NDEBUG checks can be replaced with OGRE_DEBUG_MODE checks without any other changes, and it would result in the same defaults being used.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: [SOLVED] Stuck on create workspace

Post by scrawl »

Well crap. Contrary to what I expected, OGRE_DEBUG_MODE isn't set to a fixed value either. It's set based on DEBUG, _DEBUG and similar defines, in OgrePlatform.h. For example:

Code: Select all

#   ifdef DEBUG
#       define OGRE_DEBUG_MODE 1
#   else
#       define OGRE_DEBUG_MODE 0
#   endif
That means it can't be used in headers either, at least not in ways that would produce binary-incompatible results.
I see one violation of this in the 'default' branch, in OgreSerializer.h:

Code: Select all

#define OGRE_SERIALIZER_VALIDATE_CHUNKSIZE OGRE_DEBUG_MODE
...
#if OGRE_SERIALIZER_VALIDATE_CHUNKSIZE
        typedef vector<size_t>::type ChunkSizeStack;
        ChunkSizeStack mChunkSizeStack;
        bool mReportChunkErrors;
#endif
I guess this was never noticed because no one is using OgreSerializer across library boundaries. Interesting :)

OGRE_DEBUG_MODE should be moved to OgreConfig.h and set a fixed value there (one that was configured by CMake).
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [SOLVED] Stuck on create workspace

Post by xrgo »

Hello!
I am just having the same problem:

Code: Select all

terminate called after throwing an instance of 'Ogre::ItemIdentityException'
  what():  OGRE EXCEPTION(5:ItemIdentityException): Workspace definition '[Hash 0x00000001]' not found in CompositorManager2::addWorkspace at /home/sergio/ogre/OgreMain/src/Compositor/OgreCompositorManager2.cpp
is it solved on Release? I really want to use it on release (for performance testing purpose)

I just started with ogre 2.0
and my code is this one:

Code: Select all

    root = new Ogre::Root();

    // Use the first available renderer
    Ogre::RenderSystem* renderSys = root->getAvailableRenderers()[0];
    root->setRenderSystem(renderSys);

    // Set video mode
    renderSys->setConfigOption("Full Screen", "No");
    renderSys->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");

    // Make the window
    Ogre::RenderWindow* pRenderWin = root->initialise(true);

    // Set up scene manager and one camera
    Ogre::SceneManager* pSceneMgr = root->createSceneManager(
       Ogre::ST_GENERIC,
       1,
       Ogre::INSTANCING_CULLING_SINGLETHREAD
    );

    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/models","FileSystem","General");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/scripts","FileSystem","General");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/textures","FileSystem","General");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/programs","FileSystem","General");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/programs/CG","FileSystem","General");
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/programs/GLSL","FileSystem","General");
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

    // Make camera
    Ogre::Camera* pCamera = pSceneMgr->createCamera("Camera");

    // Set up workspace
    Ogre::CompositorManager2* pCompositorManager = root->getCompositorManager2();
    const Ogre::IdString workspaceName = "sceneworkspace";
    pCompositorManager->createBasicWorkspaceDef(workspaceName, Ogre::ColourValue::Black);
    pCompositorManager->addWorkspace(pSceneMgr, pRenderWin, pCamera, workspaceName, true);

    std::cout<<"hello"<<std::endl;
I just want to see the "hello" printed out for now. If I comment the "addWorkspace" line I see the hello =)
plugins are loaded from the plugins.cfg

I am using ubuntu 14.04

Thank you very much in advance!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [SOLVED] Stuck on create workspace

Post by dark_sylinc »

The solution is in this thread. That's why it's marked solved.
Make sure your "NDEBUG" macro flag matches the one Ogre was built with. You can use "make -VERBOSE=1" to see all the compiler flags while building; and/or edit the CMake build flags (CMAKE_CXX_FLAGS_*).

Granted, I still need to fix the fact that the Ogre source code shouldn't change with NDEBUG being defined or not (this isn't fixed yet). But you can fix it for your projects.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: [SOLVED] Stuck on create workspace

Post by xrgo »

Thank you very much! it worked!
I did know that it was solved, but I didn't understand the solution, english is not my native language =). You made it more clear for me, thank you very much!
Post Reply