@SGaist said in Can rendering be done from a thread to MainWindow process?:
Are you aware that Ogre3D already provide Qt integration and has even done a major update to it ?
Yes, unfortunately, the version 1.x of Ogre is very different than the 2.x release.
@JKSH said in Can rendering be done from a thread to MainWindow process?:
Rather than QWidget, perhaps QOpenGLWidget or QOpenGLWindow might suit you better.
I'm looking at QOpenGLWindow and not exactly sure how to integrate the rendering engine I'm using.
I've done the following:
- subclassed QOpenGLWindow.
- overridden initializeGL(), resizeGL(), paintGL() which are all currently empty.
- Added QSurfaceFormat and set a default format.
What I don't understand from looking at the examples is that, I'm not making native OpenGL calls and that's how all the examples I've seen are done. Are there any examples any where's that show how to do updates from a thread?
Here is my rendering window constructor that I've been trying to convert by subclassing with QOpenGLWindow. Am I on the right track by creating my rendering window in this way? This is sort of how I did it when subclassing from QWidget in the past.
QOgreWindow::QOgreWindow(QWidget* parent) :
QOpenGLWindow(parent),
renderWindow(nullptr),
camera(nullptr),
cameraController(nullptr),
timeSinceLastFrame(0.0f)
{
int width = 800;
int height = 600;
Ogre::String windowHandle =
Ogre::StringConverter::toString((uintptr_t)(this->winId()));
params["parentWindowHandle"] = windowHandle;
renderWindow = Ogre::Root::getSingleton().createRenderWindow(
"My Window", width, height, false, ¶meters);
}