Skip to content

Embed OGRE into a QtWidget in a cross compatible way

Notifications You must be signed in to change notification settings

zb872676223/Qt-Ogre-Widget

 
 

Repository files navigation

Qt-Ogre-Widget

Embed OGRE into a QtWidget in a cross compatible way. This widget has been tested on Ubuntu 12.04 LTS, Ubuntu 14.04 LTS and Mac OS X 10.9. Additional requirements:

  • Qt 5.1
  • OGRE 1.9

Usage

This project can be compiled as a library. Extend one of your classes with the QtOgre::WindowEventListener interface and implement all abstract methods. Last bootstrap the window like this:

int main(int argc, char** argv) {
	try {
		QApplication app(argc, argv);

		QtOgre::WindowEventListener *listener = new MyWindowEventListener;
		QtOgre::QOgreWindow window(listener);
		window.show();

		return app.exec();
	} catch(const std::exception &ex) {
		// Error
		std::cerr << ex.what() << std::endl;
	}
}

Use the abstract method onSetup() to proceed with your code after the window has been created.

Why does this repository exist?

When I was starting to use OGRE, I needed a cross compatible way of handling a window to host OGRE inside of. Instead of using preprocessor if-else statements with Objective-C I decided to use Qt instead. There are a ton of information about integrating Qt into OGRE but I found it extremely hard to find a guide that worked, probably because many of them are outdated. The code might not be optimized and there might be tons of better ways to do it, but this is the result of what worked for me. I created this repository in the hopes that it could help others in the future.

Credit

I take no credit to the code inside this repository. Thanks to:

I am not claiming that the code in the links above does not work, I might have been doing something wrong.

About

Embed OGRE into a QtWidget in a cross compatible way

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 94.8%
  • C 5.2%