[2.1] Can't setup TutorialSky_Postprocess on Empty Project Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

[2.1] Can't setup TutorialSky_Postprocess on Empty Project

Post by 123iamking »

I create a new Ogre 2.1 project.
Step1: I copy the content of the file TutorialSky_Postprocess.cpp (Sample_TutorialSky_Postprocess project) to the EmptyProject.cpp (Empty project).
Step 2: I include the file TutorialSky_PostprocessGameState.h & TutorialSky_PostprocessGameState.cpp (Sample_TutorialSky_Postprocess project) to the Empty project.
Step 3: I build the Empty project - success.
Step 4: Run the Empty project app --> Crash!

Code: Select all

OGRE EXCEPTION(5:ItemIdentityException): Workspace definition 'utorialSky_PostprocessWorkspace' not found in CompositorManager2::addWorkspace at ...\OgreMain\src\Compositor\OgreCompositorManager2.cpp (line 493)
I have searched for this error: [SOLVED] Stuck on create workspace, [SOLVED] How to setup a workspace. And they said something about NDEBUG macro.
I don't understand about NDEBUG macro, so I try to debug 2 project: Sample_TutorialSky_Postprocess project -> Work, Empty project -> Crash. And I see the difference in this same code from both projects.

Code: Select all

        CompositorWorkspaceDefMap::const_iterator itor = mWorkspaceDefs.find( definitionName );
        if( itor == mWorkspaceDefs.end() )
        {
            OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Workspace definition '" +
                            definitionName.getFriendlyText() + "' not found",
                            "CompositorManager2::addWorkspace" );
        }
I see that in Sample_TutorialSky_Postprocess, mWorkspaceDefs has 17 items, but in Empty project, mWorkspaceDefs has 0 item. That's why Empty project throw the exception.
I thought same code produce same result. Please help.
123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 4

Re: [2.1] Can't setup TutorialSky_Postprocess on Empty Proje

Post by 123iamking »

Ahhh I got it, The problem is Ogre Empty project didn't load the Compositors script.
To make the Empty project load the Compositors of TutorialSky_Postprocess, first you have to copy these Compositors script to the Empty project. Ok, here is how to do it step by step.

Step 1: Copy all of content in the folder [The folder where you put OgreSDK(GitSource)]\Samples\Media to the folder [Your empty project folder]\bin\Data
Note: I know, you only need ..\Samples\Media\2.0\scripts\Compositors , but just to be sure.

Step 2: Add the following text to the resources2.cfg file in your Empty project output directory (Ex: ..\bin\Debug if you run in Debug mode)

Code: Select all

[Popular]
...
FileSystem=../Data/2.0/scripts/Compositors
FileSystem=../Data/models
FileSystem=../Data/materials/textures
FileSystem=../Data/Media/materials/textures/Cubemaps
...
Note: once again, you only need ../Data/2.0/scripts/Compositors, but just to be sure.

There you go, no more crash, you can start the application, but you will see the black sky box, to fix this, just add the sky box resource. Anyway, the big crash problem has been solve and you know why, everything else should be piece of cake.
----------------
That's how you fix the hard way, but if you still confuse with the fix above, here is a easier fix, just copy and replace the file [Ogre build with CMake from OgreSDK]\bin\debug\resources2.cfg to the file [Your Empty project folder]\bin\Debug\resources2.cfg .
Because the file resources2.cfg you just copied use absolute path, so your Empty project will use resource files of the OgreSDK.
Post Reply