[2.x] Camera null when adding new scenemanager and camera to workspace

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Lax
Orc
Posts: 492
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

[2.x] Camera null when adding new scenemanager and camera to workspace

Post by Lax »

Hi,

I'm testing some more complex scenarios. I have several Application states like a MenuState, GameState. First the MenuState is called with its scenemanager, and workspace. When the user starts the game, I push the GameState on the top of the MenuState (creating new scenemanager, camera and adding a workspace) and not deleting anything from the MenuState.

Code: Select all

addWorkspace(this->sceneManager, Core::getSingletonPtr()->getOgreRenderWindow()->getTexture(), camera, "NOWAPbsWorkspace", true);
So each time, a new workspace is added. Because I want to keep also the menu state, so that the user can change from the game to menu, e.g. save the game and continue in the GameState. But, when its comes to renderOneFrame, I always get an crash, because the renderingCamera is 0.

Several places are triggered:
OgreHlms.cpp:

Code: Select all

if( sceneManager->getCamerasInProgress().renderingCamera->getNeedsDepthClamp() )
OgreHlmsPbs.cpp:

Code: Select all

 CamerasInProgress cameras = sceneManager->getCamerasInProgress();
 mConstantBiasScale = cameras.renderingCamera->_getConstantBiasScale();
Matrix4 viewMatrix = cameras.renderingCamera->getVrViewMatrix( 0 );
OgreHlmsUnlit.cpp:

Code: Select all

mConstantBiasScale = cameras.renderingCamera->_getConstantBiasScale();
 Matrix4 viewMatrix = cameras.renderingCamera->getViewMatrix(true);

 Matrix4 projectionMatrix = cameras.renderingCamera->getProjectionMatrixWithRSDepth();
In fact, I do not understand, why the rendering camera is 0, as no destructor is called and the scenemanager is possesses 6 valid camera, but the renderingCamera is 0.

Is this an Ogre bug? Because I have no idea, how to solve this on my side.

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

Lax
Orc
Posts: 492
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Re: [2.x] Camera null when adding new scenemanager and camera to workspace

Post by Lax »

ok, got it almost working. It was not a good idea to add 2 workspaces with different scenemangers and camera. Now I switch to just one active workspace.
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 105
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 28

Re: [2.x] Camera null when adding new scenemanager and camera to workspace

Post by sercero »

I'm glad you could resolve it.

Its a great engine you have there.

Lax
Orc
Posts: 492
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Re: [2.x] Camera null when adding new scenemanager and camera to workspace

Post by Lax »

Its a great engine you have there.
Thanks :) ! I'm trying to finish a complete Game scenario, wie menu, loading game, saving game, deployment up to setup.
Unfortunaltely I'm alone with all that stuff. So it will only work on a windows system for now.
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 105
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 28

Re: [2.x] Camera null when adding new scenemanager and camera to workspace

Post by sercero »

Good luck, waiting for that showcase :D

Post Reply