Hiya, I looked at the osgQt/GraphicsWindowQt class implementation. I think what it does is render to Qt's QGLWidget's OpenGL context using swapBuffers(). Again... being new to OpenGL, a lot of this stuff doesn't really make too much sense to me, but the swapBuffers() call is QGLWidget specific. There's no equivalent in the QDeclarative API, so I couldn't find a way of exposing QGLWidget to QtQuick directly as a QDeclarative item.
>From what I've read online, I think that the best that can be done is creating a custom QDeclarativeItem, and overriding its paint() method, where direct OpenGL calls can be made. I tested this out and it works... I can, for instance, paint geometry using glBegin() and glEnd() exactly as you'd expect, and it'll show up in a QML object. So I think I need to use OSG to render my scene as a texture to an FBO, then draw that using straight OpenGL calls. This is where I'm totally lost though. So if I had to rephrase the problem: Assuming I had a viewport I could only paint to using native OpenGL calls, how could I render an OpenSceneGraph scene in it? Regards, Preet On Fri, Feb 17, 2012 at 4:27 AM, Philipp Moeller <philipp.moel...@geometryfactory.com> wrote: > Preet <prismatic.proj...@gmail.com> writes: > >> Hey all. >> >> I have an OpenSceneGraph tree I'd like to have displayed in QtQuick. >> I'd like the user to be able to interact with the scene where the >> mouse can zoom/pan/rotate the camera, just like osgViewer allows. I >> saw that there were a couple of examples (osgQtWidgets and >> osgQtBrowser), but they're a little over my head. >> >> I think the right way to start trying this is by starting with the >> QtDeclarative model >> (http://doc.qt.nokia.com/4.7-snapshot/qtdeclarative.html)... but I'm >> not too sure where to go from here. Does anyone have any suggestions? >> >> Regards, >> >> Pris > > Hi Preet, > > I've looked into integrating OpenSceneGraph into QML. You might want to > start with the osgviewerQt to get started with a viewer integrated into > Qt. Then you should have a look at [1] to see how you can expose your > osg widget to QML. If I ever get something reusable up and running, I'll > let the list know. If you go down the route of exposing scene graph > functionality in your Qt application you will need to roll some > implementation of QAbstractItemModel, which is a real pain. It get's > easier if you restrain yourself to graphs where each element only has a > single parent. If you can throw something together I would be really > interested in it, so let me know. > > [1] : > http://developer.qt.nokia.com/doc/qt-4.8/gettingstartedqml.html#exposing-c-classes-to-qml > > -- > Philipp Moeller > GeometryFactory > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org