Program crashes when TrayManager is used!!!

Problems building or running the engine, queries about how to use features etc.
Post Reply
jhny
Gnoblar
Posts: 10
Joined: Sun Jan 28, 2018 9:18 pm

Program crashes when TrayManager is used!!!

Post by jhny » Wed Jul 17, 2019 11:46 pm

Ogre Version: :1.12.1:
Operating System: :win10 1903:
Render System: :don't know:


Can someone explain why after the compilation of my code the program crashes with the exception error 0x00007FF91FA50026 (OgreBites.dll) ??
That only happens when I insert the TrayManager line:

Code: Select all

mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
Also here it comes to exception error:

Code: Select all

mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
Did not I insert the object correctly?

Can someone help me here? :?: :?:

Here is my code:

Code: Select all





#include "Ogre.h"
#include "OgreApplicationContext.h"
#include "OgreInput.h"
#include "OgreRTShaderSystem.h"
#include "OgreApplicationContext.h"
#include <iostream>
#include <OgreRoot.h>
#include <OgreTrays.h>





using namespace Ogre;
using namespace OgreBites;

Ogre::Root* root;
Ogre::RenderWindow* window;
//OgreBites::ParamsPanel* mDetailsPanel;
OgreBites::TrayManager* mTrayMgr;





class MainTest
	: public ApplicationContext
	, public InputListener
	
{
public:
	MainTest();

	virtual ~MainTest() {}
	//bool keyPressed(const KeyboardEvent& evt);
	void setup();
	//void panel();


};

MainTest::MainTest()
	: ApplicationContext("OgreTutorialApp")
{
}


/*void MainTest::panel()
{
	mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
}
*/
void MainTest::setup()
{

	ApplicationContext::setup();
	addInputListener(this);


	


	Root* root = getRoot();
	SceneManager* scnMgr = root->createSceneManager();
	RTShader::ShaderGenerator* shadergen = RTShader::ShaderGenerator::getSingletonPtr();
	shadergen->addSceneManager(scnMgr);


	Light* light = scnMgr->createLight("MainLight");
	SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
	lightNode->attachObject(light);
	lightNode->setPosition(20, 80, 50);
	SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode();

	
	Camera* cam = scnMgr->createCamera("myCam");
	cam->setNearClipDistance(5); // specific to this sample
	cam->setAutoAspectRatio(true);
	camNode->attachObject(cam);
	camNode->setPosition(0, 0, 140);

	
	getRenderWindow()->addViewport(cam);
	
	mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
	
		/* mDetailsPanel = mTrayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
		mDetailsPanel->setParamValue(9, "Bilinear");
		mDetailsPanel->setParamValue(10, "Solid");
		mDetailsPanel->hide();
		mTrayMgr->adjustTrays();
		*/
	/*
	Ogre::StringVector items;
	items.push_back("cam.pX");
	items.push_back("cam.pY");
	items.push_back("cam.pZ");
	items.push_back("");
	items.push_back("cam.oW");
	items.push_back("cam.oX");
	items.push_back("cam.oY");
	items.push_back("cam.oZ");
	items.push_back("");
	items.push_back("Filtering");
	items.push_back("Poly Mode");
	
	*/

	
}



int main()

{
	try
	{


		MainTest app;

		MainTest();
		app.initApp();
		app.getRoot()->startRendering();

		return 0;
	}
	catch (const std::exception& e)
	{
		std::cerr << "Error occurred during execution: " << e.what() << '\n';
		//system("pause");
		return -1;

	}
}



0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 836
Joined: Sun Mar 30, 2014 2:51 pm
x 147
Contact:

Re: Program crashes when TrayManager is used!!!

Post by paroj » Thu Jul 18, 2019 10:50 am

you need to register the overlay system, see here https://github.com/OGRECave/ogre/blob/m ... ple.py#L44
0 x

jhny
Gnoblar
Posts: 10
Joined: Sun Jan 28, 2018 9:18 pm

Re: Program crashes when TrayManager is used!!!

Post by jhny » Thu Jul 18, 2019 9:09 pm

I have inserted the line:

Code: Select all

scnMgr->addRenderQueueListener(mOverlaySystem);
....and still have the problem with the exception error.
0 x

jhny
Gnoblar
Posts: 10
Joined: Sun Jan 28, 2018 9:18 pm

Re: Program crashes when TrayManager is used!!!

Post by jhny » Fri Jul 19, 2019 9:04 pm

The execution error is no longer there. I looked into the API reference. Now I get the error message in the console when starting the .exe:

Code: Select all

Error occurred during execution: Ogre::RuntimeAssertionException::RuntimeAssertionException: There can be only one singleton in Ogre::Singleton<class Ogre::OverlayManager>::Singleton at c:\projects\ogre-bsrh7\ogremain\include\OgreSingleton.h (line 76)
I have inserted these lines:

Code: Select all

Ogre::OverlaySystem* pOverlaySystem = new Ogre::OverlaySystem();

	scnMgr->addRenderQueueListener(pOverlaySystem); 
	
	addInputListener(mTrayMgr);
(I have not inserted a tray yet.)
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 836
Joined: Sun Mar 30, 2014 2:51 pm
x 147
Contact:

Re: Program crashes when TrayManager is used!!!

Post by paroj » Fri Jul 19, 2019 11:27 pm

you must not create another overlay system. The application context already does that for you.

See this for an C++ usage of Trays:
https://github.com/OGRECave/particleuni ... erseDemo.h
0 x

jhny
Gnoblar
Posts: 10
Joined: Sun Jan 28, 2018 9:18 pm

Re: Program crashes when TrayManager is used!!!

Post by jhny » Sat Jul 20, 2019 8:36 pm

Ok, thanks for your feedback. I can use trays now.

Greetings,

Jhny
:mrgreen: :mrgreen:
0 x

Post Reply