Demo: Integrating OpenSceneGraph with Qt Quick
-
Hi,
In QuickWindowViewer::Hidden::frame(), the call to QOpenGLContext::currentContext() is returning null for me. The osgviewer and Qt's QML examples work perfectly well, and my machine supports FBOs (OpenGL v3.0) - any ideas why a context couldn't be created? -
I found the problem, the signal/slot connection to the failing method:
@connect(window, SIGNAL(beforeRendering()), this, SLOT(frame()));@
It should be specified as a Qt::DirectConnection as noted in the "QQuickWindow docs":http://qt-project.org/doc/qt-5.0/qtquick/qquickwindow.html#exposure-and-visibility - "Warning: As signals related to rendering might be emitted from the rendering thread, connections should be made using Qt::DirectConnection."
-
Hi Konstantin,
I recently got some more time to look into your project again. As I stated before I like the way you integrate osg and qt/qml.
I tried to extent the functionality by adding some osg pickers to allow identifying the name and type of a node underneath the mouse. This seems to work initially, but unfortunatly it doesn't after a resize of the window.
Do you have any idea why this occurs? My guess is that something does not get the new window size after a resize, but which object? Hopefully you could give me another pointer to try and get this fixed.
Thank you very much!
Rooi
-
Hi,
I managed to get the picker to work by doing the following:
Add the following lines to updateViewport()
QSize size(quickItem->boundingRect().size().toSize());
if(view->getCamera()->getGraphicsContext())
view->getCamera()->getGraphicsContext()->resized( 0, 0, size.width(), size.height() );Thanks.
-
Hi Konstantin,
Sub: enable multisampling
Your example is really well done, Thanks. Now I want to enable multisampling, but I can not figure out how to enable it. I want to use the buffer mode.
The QOpenGLFramebufferObjectFormat.setSamples(4) does not seem to work. I don't have a very deep knowledge or osg::GraphicsWindow and its traits. But if you can guide me, I can take a look.Thanks a lot,
-
Hi Konstantin,
Sub: enable multisampling
Your example is really well done, Thanks. Now I want to enable multisampling, but I can not figure out how to enable it. I want to use the buffer mode.
The QOpenGLFramebufferObjectFormat.setSamples(4) does not seem to work. I don't have a very deep knowledge or osg::GraphicsWindow and its traits. But if you can guide me, I can take a look.Thanks a lot,
-
@rooi
oh I am facing the same problem as you did. when I resize the windows ,it seems that the Qopenglcontext turn to null . so the fbo is initialized failed. using the method you give it does not work . i try to delete the updatafbo it works but the size of texture does not changed any more. -
Meet osgQtQuick 2.0!
-
Wow! More than 10 000 views :-)
It seems that many who like it!I repeat: Meet osgQtQuick 2.0!