PDA

View Full Version : Ogre3D Integration with Qt on Apple Mac OS X, x11info not found



WJWwood
20th January 2011, 01:56
Hi, I am trying to setup an application using Qt in QtCreator, using qmake that uses Qt as the windowing engine, but has some widget(s) with an Ogre3D instance in them.

I am following the guide on how to integrate Ogre3D into Qt here: http://www.ogre3d.org/tikiwiki/QtOgre

The example code on the wiki uses the Qt functions initializeGL, paintGL, and resizeGL to draw the Ogre instance into the Qt widget. As part of this process it uses the following in the initialization:


QX11Info info = x11Info();
Ogre::String winHandle;
winHandle = Ogre::StringConverter::toString((unsigned long)(info.display()));
winHandle += ":";
winHandle += Ogre::StringConverter::toString((unsigned int)(info.screen()));
winHandle += ":";
winHandle += Ogre::StringConverter::toString((unsigned long)(this->parentWidget()->winId()));

Ogre::NameValuePairList params;
params["parentWindowHandle"] = winHandle;

mOgreWindow = mOgreRoot->createRenderWindow( "QOgreWidget_RenderWindow",
this->width(),
this->height(),
false,
&params );

mOgreWindow->setActive(true);
WId ogreWinId = 0x0;
mOgreWindow->getCustomAttribute( "WINDOW", &ogreWinId );

assert( ogreWinId );

this->create( ogreWinId );
setAttribute( Qt::WA_PaintOnScreen, true );
setAttribute( Qt::WA_NoBackground );

The line I am interested in is the first line. The x11info() function is not available on Mac (and presumably not on Windows) so what equivalent functions could I use to gain the same effect cross platform?

I would appreciate any help anyone could give on this topic.