Integrating OpenSceneGraph with Qt
Asked Answered
H

4

16

I have fiddled around with OpenGL on Qt. But now I want to have complex scenes. (With multiple COLLADA/MD2 models loaded).

For this I'm thinking of using OpenSceneGraph (OSG). Is it possible to integrate OSG with Qt? If so how to?

Thanks.

Hindman answered 8/1, 2012 at 20:17 Comment(0)
M
16

OpenSceneGraph has an osgQt library that makes it easy to integrate OpenSceneGraph within Qt. Head up to the the samples and specifically the osgviewerQt one!

Ministration answered 20/1, 2012 at 13:38 Comment(0)
H
1

Yes - I haven't worked on OSG for a year but there was a very good Qt widget in OSG that worked well enough for a commercial product.

With the new improvements in openGL in 4.8 it should be even better

You should probably search the osg forum

Hebdomadal answered 8/1, 2012 at 21:48 Comment(1)
osgQt Widgets for OSG currently don't work when using Qt 5.x and multithreaded renderingKrenn
I
1

Just to point out at another resource (which works with QOpenGLWidget): an article Making Qt and OpenSceneGraph play nice by Bastian Rieck. It will be useful for those who are interested in doing render of different scenes on different widgets while performing updates on demand only (without timer). The article has a link to a source code.

Illmannered answered 20/11, 2015 at 16:20 Comment(0)
R
0

I wrote a simple class that derives from QOpenGLWidget, and can be used as a normal widget, that encapsulates osgViewer::GraphicsWindowEmbedded, and also (optionally) allows to use the mouse inside the widget to control the camera.

Its usage is as simple as:

#include <QApplication>
#include <QMainWindow>

#include "QtOSGWidget.h"

int main(int argc, char** argv)
{
    QApplication qapp(argc, argv);
    QMainWindow window;

    QtOSGWidget widget(&window);

    window.setCentralWidget(&widget);
    window.show();
    return qapp.exec();
}

It can be found on GitHub.

Rotenone answered 12/9, 2019 at 23:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.