Re: [osg-users] OSG and QT example
Hi Benjamin, We have improved Qt integration checked into svn/trunk as part of the new osgQt library. Submissions would be best built upon this new work rather than introducing yet another variation of Qt integration. Cheers, Robert. On Thu, Jan 20, 2011 at 9:42 PM, Benjamin Wasty bennywa...@gmx.de wrote: Hi, I worked on a Qt-widget integration for my university based on the Delta3D files posted earlier by David Guthrie. I made a few changes - mainly to make multi-threaded rendering really work. We'd be willing to make a submission if there's interest. My current version is attached - feedback would be welcome as this is the first time I worked with OSG. Below are some details and open issues: The class QtViewer inherits from osgViewer::Viewer and OSGAdapterWidget. It does some setup and calls frame() in its updateGL() method. Context sharing between Qt and OSG didn't work when OSG was running multi-threaded - in the end (after quite a few hours of debugging) I just 'switched' the two contexts in OSGAdapterWidget - the QGLWidget keeps its original one and the additional one created in threadedInitializeGL() is used by the OSG draw thread (OSGGraphicsWindowQt directs the makeCurrent/doneCurrent()-calls to that context). Improved mapping from Traits/osg::DisplaySettings to QGLFormat Removed QtGuiWindowSystemWrapper and GLWidgetFactory because we don't need them (but only commented out) No rendering when Widget is hidden (otherwise some access violation occurs) One remaining problem is that there is quite a lag when the main window is moved or resized, because Qt apparently doesn't have enough time to render fluently due to the blocking caused by vsync. Increasing the interval for the update timer helps, but reduces the framerate and in my opinion the now used 10ms are already too much. Should the frame()-call maybe moved to a separate thread like there: forum . openscenegraph . org / viewtopic.php?p=17387#17387 ? (2 posts before I can post URLs? I don't have time for that...) A quick test with that code didn't work, but I didn't pursue it further so far. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35820#35820 ___ 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
Re: [osg-users] OSG and QT example
Sounds quite interesting. -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Benjamin Wasty Sent: Friday, January 21, 2011 3:13 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] OSG and QT example Hi, I worked on a Qt-widget integration for my university based on the Delta3D files posted earlier by David Guthrie. I made a few changes - mainly to make multi-threaded rendering really work. We'd be willing to make a submission if there's interest. My current version is attached - feedback would be welcome as this is the first time I worked with OSG. Below are some details and open issues: The class QtViewer inherits from osgViewer::Viewer and OSGAdapterWidget. It does some setup and calls frame() in its updateGL() method. Context sharing between Qt and OSG didn't work when OSG was running multi-threaded - in the end (after quite a few hours of debugging) I just 'switched' the two contexts in OSGAdapterWidget - the QGLWidget keeps its original one and the additional one created in threadedInitializeGL() is used by the OSG draw thread (OSGGraphicsWindowQt directs the makeCurrent/doneCurrent()-calls to that context). Improved mapping from Traits/osg::DisplaySettings to QGLFormat Removed QtGuiWindowSystemWrapper and GLWidgetFactory because we don't need them (but only commented out) No rendering when Widget is hidden (otherwise some access violation occurs) One remaining problem is that there is quite a lag when the main window is moved or resized, because Qt apparently doesn't have enough time to render fluently due to the blocking caused by vsync. Increasing the interval for the update timer helps, but reduces the framerate and in my opinion the now used 10ms are already too much. Should the frame()-call maybe moved to a separate thread like there: forum . openscenegraph . org / viewtopic.php?p=17387#17387 ? (2 posts before I can post URLs? I don't have time for that...) A quick test with that code didn't work, but I didn't pursue it further so far. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35820#35820 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
Hi, is there meanwhile a sort of standard way of integration osg views as qt widgets in a way that allows to handle them like normal widgets on the qt side ? Thank you! Cheers, Jan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30486#30486 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
The best overview comes from examples/osgQtWidgets/osgQtWidgets.cpp... //We would need to document the following somewhere in order to guide people on //what they need to use... // //-- //There are two angles to consider. // //1. If someone wants a widget in their Qt app to be an OSG-rendered scene, they //need GraphicsWindowQt (in the osgViewerQtContext example) or QOSGWidget (in the //osgViewerQt example). These two allow both OSG and Qt to manage their threads //in a way which is optimal to them. We've used QOSGWidget in the past and had //trouble when Qt tried to overlay other widgets over the QOSGWidget (since OSG //did its rendering independently of Qt, it would overwrite what Qt had drawn). I //haven't tried GraphicsWindowQt yet, but I expect since it uses QGLWidget, it //will result in Qt knowing when OSG has drawn and be able to do overlays at the //right time. Eventually GraphicsWindowQt can be brought into osgViewer I imagine... // //2. If someone wants to bring Qt widgets inside their OSG scene (to do HUDs or //an interface on a computer screen which is inside the 3D scene, or even //floating Qt widgets, for example). That's where QGraphicsViewAdapter + //QWidgetImage will be useful. //-- I've used both QOSGWidget and GraphicsWindowQt in full blown Qt applications. In both cases I made classes that inherited one of the above along with osgViewer::View. QOSGWidget works pretty well as is. I had to break the GraphicsWindowQt constructor into parts to use a QWidget created elsewhere in the Qt application. -Don Leich Hi, is there meanwhile a sort of standard way of integration osg views as qt widgets in a way that allows to handle them like normal widgets on the qt side ? Thank you! Cheers, Jan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
mgb_osg wrote: Not sure if it's what you mean but you can easily create multiple OSGWidget windows with the same osg scene data in each of them and have different views into the same model in different windows. There are issues thut must be addressed: multi-threading, thread-safety, Qt keyboard mapping, and context management. The Delta3D dtQt plug-in provides a wrapper for these issues. I was wondering if someone had a simple example using these (or similar). -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=26531#26531 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
LEgregius wrote: Hi, Yes, it does fix the keyboard issues, at least most of them, and I have done some minor testing with the threading and it seems to work. Hey David, I'm not sure if this thread is still alive, but have you tested the case of rendering a single OSG scene-graph in multiple Qt windows (i.e. sharing the same graphics context)? If so, do you have a Hello, World example of this with the dtQt elements you referenced? Cheers, Ben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=26498#26498 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
hi David, I'm also interested in your work. Like Simon I had problems with QOSGWidget and was frustrated with the limitations of AdapterWidget. Richard On Mon, May 11, 2009 at 11:19 PM, Simon Loic simon1l...@gmail.com wrote: Hi David, Just to answer your point, I would be personally interested in such an integration. So far I'm using the AdapterWidget of the ViewerQt example but I'm not fully satisfied. Indeed it suffers a couple of problems as : - the lack of multiple thread support - a bad translation between QT keyboard events and OSG one. I had a quick look to the code you pointed and both seems to be handled in it (tell me if I'm wrong). As for the QOSGWidget, I tried to embed it in a QtDesigner based GUI and I must confess I couldn't make it. May be I dind't try hard enough. Yet if someone could provide such an example (ie without the trick to avoid the moc steps and so on), that would be hell of a tip. Thanks On Thu, May 7, 2009 at 8:43 PM, David Guthrie dguth...@alionscience.comwrote: Hi, We wrote a QT/OSG integration that implements the windowing system interface for qt. It's in the delta3d dtQt library. It seems like the sort of thing that should be part of OSG, we just haven't submitted it. If there is interest, we can look at what the code should look like and where it should go... Look at https://delta3d.svn.sourceforge.net/svnroot/delta3d/trunk/delta3d/inc/dtQt https://delta3d.svn.sourceforge.net/svnroot/delta3d/trunk/delta3d/src/dtQt at the files osgadapterwidget.h osggraphicswindowqt.h qtguiwindowsystemwrapper.h osgadapterwidget.cpp osggraphicswindowqt.cpp qtguiwindowsystemwrapper.cpp Thank you! David Guthrie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11639#11639 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Loïc Simon ___ 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
Re: [osg-users] OSG and QT example
Hi David, Just to answer your point, I would be personally interested in such an integration. So far I'm using the AdapterWidget of the ViewerQt example but I'm not fully satisfied. Indeed it suffers a couple of problems as : - the lack of multiple thread support - a bad translation between QT keyboard events and OSG one. I had a quick look to the code you pointed and both seems to be handled in it (tell me if I'm wrong). As for the QOSGWidget, I tried to embed it in a QtDesigner based GUI and I must confess I couldn't make it. May be I dind't try hard enough. Yet if someone could provide such an example (ie without the trick to avoid the moc steps and so on), that would be hell of a tip. Thanks On Thu, May 7, 2009 at 8:43 PM, David Guthrie dguth...@alionscience.comwrote: Hi, We wrote a QT/OSG integration that implements the windowing system interface for qt. It's in the delta3d dtQt library. It seems like the sort of thing that should be part of OSG, we just haven't submitted it. If there is interest, we can look at what the code should look like and where it should go... Look at https://delta3d.svn.sourceforge.net/svnroot/delta3d/trunk/delta3d/inc/dtQt https://delta3d.svn.sourceforge.net/svnroot/delta3d/trunk/delta3d/src/dtQt at the files osgadapterwidget.h osggraphicswindowqt.h qtguiwindowsystemwrapper.h osgadapterwidget.cpp osggraphicswindowqt.cpp qtguiwindowsystemwrapper.cpp Thank you! David Guthrie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11639#11639 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Loïc Simon ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
Hi, Yes, it does fix the keyboard issues, at least most of them, and I have done some minor testing with the threading and it seems to work. ... Thank you! Cheers, David -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11839#11839 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG and QT example
Is there a more complex example of using QT (4.5) with OSG (2.8) than the osgviewerQT example? I want to use the AdapterWidget and interface an OSG viewer to a QT form which has been designed with buttons/controls using QT Designer. Thanks in advance, Paul P. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and QT example
Unless I'm misunderstanding there are already two ways to integrate osg with Qt (QOSGWidget and adapterWidget - plus a few composite versions) The osgviewerQT example is a little artificial to avoid the moc step. which is what I thought the OP was asking about. It would be nice to integrate the Qt widgets into QOSGWidget so that you can have Qt controls drawn (eg with transparency) onto the OSG view - as described here http://labs.trolltech.com/blogs/2008/06/27/accelerate-your-widgets-with-opengl/ I was taking a look at it but more important stuff came up ;-( It does seem that doing everything in OpenGL is part of the Qt future strategy - which can only be good for OSG. Cheers, Martin Beckett -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11645#11645 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org