Re: [osg-users] OpenSceneGraph with Qt multiple windowing problem
Hi Robert, thanks for the information about the contexts. Now my task seems to me easier that I thought. I'm subclassing from osgViewer::GraphicsWindow, so I think I'll have to take account for the context IDs and the osg::State, as the osgwxviewer does (though only for one view). Anyways, I have the aid of the osgViewer::GraphicsWindowEmbedded class to copy some of its implementation details. Alberto El Thursday 20 September 2007 17:51:57 Robert Osfield escribió: Hi Alberto, On 9/20/07, Alberto Luaces [EMAIL PROTECTED] wrote: I'm a bit confused about the naming. What do you mean by graphics context? An OpenGL one or an osg::GraphicsContext? osg::GraphicsContext maps directly to an OpenGL context so there should not be any confusion. I ask because currently I have a wxWidgets application with two views of the same scene. Each view is attached to an osgViewer::GraphicsWindow which in turn controls its wxGLcanvas. The two wxGLcanvas were created with a common OpenGL context, so all the GL objects as display lists, textures... are shared. Each osgViewer::GraphicsWindow has one osg::State. A sharing OpenGL contexts doesn't mean actually sharing of the context, its just sharing some data between contexts, so you don't have a common OpenGL context, you have two separate OpenGL contexts that are sharing display lits/texture objects etc. Each GraphicsWindow is a GraphicsContext which maps directly to a single OpenGL graphics context. Each OpenGL graphics context has its own state machine which is mapped by a single osg::State object - which you'll find on the GraphicsContext. Sharing of display lists/texture objects between contexts on the OSG just requires you to set the State::ContextID to same value. If the GraphicsWindow implementation is set up correctly then it'll automatically assign the same ContextID for each of the seperate osg::State objects. In summary I have 2 wxGLCanvas ( sharing GL objects, one only common wxGLContext) 2 osgViewer::GraphicsWindow ( which are in fact 2 osg::GraphicContext) 2 osgViewer::View (I'm using osgViewer::CompositeViewer) 2 osg::State (not sure if only one would do) If, in addition, I wanted to show two more views of a new different scene, should I do the same as before (creating 2 GraphicsWindows, 2 Views, 2 States and connect them to the 2 wxGLCanvas with a new shared OpenGL context) and attaching the Views to the existing CompositeViewer or should I create a new CompositeViewer and attach the 2 new Views there? Ideally a single CompositeViewer should be used per app, and the various Views and associate GraphicsWindow managed according to your needs. The osg::State objects should all be managed as an implementation detail, you shouldn't need to concern yourself with it. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph with Qt multiple windowing problem
Hi Alberto, On 9/21/07, Alberto Luaces [EMAIL PROTECTED] wrote: thanks for the information about the contexts. Now my task seems to me easier that I thought. I'm subclassing from osgViewer::GraphicsWindow, so I think I'll have to take account for the context IDs and the osg::State, as the osgwxviewer does (though only for one view). Anyways, I have the aid of the osgViewer::GraphicsWindowEmbedded class to copy some of its implementation details. Have a look at the way the constructor/init is done for the GraphicsWindowWin32/X11/Carbon - they all provide a path for detecting use of shared contexts and manage the contextID accordingly. GraphicsWindowEmbedded itself is just a shell. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph with Qt multiple windowing problem
Hi Arnaud, Viewer and CompositeViewer can both share scenes between them. What you are trying to do is supported, and already works well see the osgcompsiteviewer. The complication in your case is that QT is quite up to scratch for this type of work makes it more awkward - its OpenGL support isn't quite sophisticated enough to do things the most straight forward way. There are ways around this as I said in my previous email. Robert. On 9/20/07, arnaud houegbelo [EMAIL PROTECTED] wrote: Hi David and Robert, Thanks for the looking about my problem. I use Windows XP with AMD Athlon (tm) 64 Processor 2008+ 1.80 Ghz, OSG_THREADING = SingleThreaded OSG_OPTIMIZER = DEFAULT.. About the multiple windowing problem, the Viewer/Composite It's a good idea but in this way I must display the differents sceneGrpah in the same window. But I want to have differents sceneGraph in differents windows. According you Robert, It seems that for the moment It is not possible to have what I want. Do you think that It can be possible in a next version of osg. It is a real need for the Osg comunity? I don't really know If my request it's interesting for the others people. About your approach to inherit the native windowing into a GraphicsWindowWin32/Carbon/X11 in a way that adapts a Qt window via its native windowing implementatio can you give me more precision and direction to help me If I want to develop myself to try to correct this probelm. Others are welcome too, to find a solution :-) Many thanks and Best regards Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=listsid=396545469 ___ 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] OpenSceneGraph with Qt multiple windowing problem
El Wednesday 19 September 2007 20:58:00 Robert Osfield escribió: For apps that have multiple windows and mulitple views on to one or more scenes that CompositeViewer is the most apporpriate tool. There is but though, running with multiple graphics context is not possible when one use GraphicsWindowEmbedded - only single threaded, single context per Viewer/CompositeViewer is possible. If you have multiple Windows then you need a separate Viewer/CompositeViewer for each one. I'm a bit confused about the naming. What do you mean by graphics context? An OpenGL one or an osg::GraphicsContext? I ask because currently I have a wxWidgets application with two views of the same scene. Each view is attached to an osgViewer::GraphicsWindow which in turn controls its wxGLcanvas. The two wxGLcanvas were created with a common OpenGL context, so all the GL objects as display lists, textures... are shared. Each osgViewer::GraphicsWindow has one osg::State. In summary I have 2 wxGLCanvas ( sharing GL objects, one only common wxGLContext) 2 osgViewer::GraphicsWindow ( which are in fact 2 osg::GraphicContext) 2 osgViewer::View (I'm using osgViewer::CompositeViewer) 2 osg::State (not sure if only one would do) If, in addition, I wanted to show two more views of a new different scene, should I do the same as before (creating 2 GraphicsWindows, 2 Views, 2 States and connect them to the 2 wxGLCanvas with a new shared OpenGL context) and attaching the Views to the existing CompositeViewer or should I create a new CompositeViewer and attach the 2 new Views there? Thanks for the tips, Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph with Qt multiple windowing problem
Hi Alberto, On 9/20/07, Alberto Luaces [EMAIL PROTECTED] wrote: I'm a bit confused about the naming. What do you mean by graphics context? An OpenGL one or an osg::GraphicsContext? osg::GraphicsContext maps directly to an OpenGL context so there should not be any confusion. I ask because currently I have a wxWidgets application with two views of the same scene. Each view is attached to an osgViewer::GraphicsWindow which in turn controls its wxGLcanvas. The two wxGLcanvas were created with a common OpenGL context, so all the GL objects as display lists, textures... are shared. Each osgViewer::GraphicsWindow has one osg::State. A sharing OpenGL contexts doesn't mean actually sharing of the context, its just sharing some data between contexts, so you don't have a common OpenGL context, you have two separate OpenGL contexts that are sharing display lits/texture objects etc. Each GraphicsWindow is a GraphicsContext which maps directly to a single OpenGL graphics context. Each OpenGL graphics context has its own state machine which is mapped by a single osg::State object - which you'll find on the GraphicsContext. Sharing of display lists/texture objects between contexts on the OSG just requires you to set the State::ContextID to same value. If the GraphicsWindow implementation is set up correctly then it'll automatically assign the same ContextID for each of the seperate osg::State objects. In summary I have 2 wxGLCanvas ( sharing GL objects, one only common wxGLContext) 2 osgViewer::GraphicsWindow ( which are in fact 2 osg::GraphicContext) 2 osgViewer::View (I'm using osgViewer::CompositeViewer) 2 osg::State (not sure if only one would do) If, in addition, I wanted to show two more views of a new different scene, should I do the same as before (creating 2 GraphicsWindows, 2 Views, 2 States and connect them to the 2 wxGLCanvas with a new shared OpenGL context) and attaching the Views to the existing CompositeViewer or should I create a new CompositeViewer and attach the 2 new Views there? Ideally a single CompositeViewer should be used per app, and the various Views and associate GraphicsWindow managed according to your needs. The osg::State objects should all be managed as an implementation detail, you shouldn't need to concern yourself with it. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph with Qt multiple windowing problem
Hi arnaud I can't reproduce your problem. I have 4 osg window in the mainWindow and all have the same frame rate. Can you describe you plateform driver vertion OSG, Qt OSG_OPTIMIZE and OSG_CAMERA_THREAD env var ... another think is thit is preferable to use osgViewer::CompositeViewer and osgViewer::View instead of osgViewer::Viewer when you have many scene and so many view. With this, all update/cull/draw/ operations are done with the Thread Model choose in the osgViewer::CompositeViewer, and so do the best management of all update/cull/draw/ operation of each View. This include to swapping OpenGL buffer all together. I never could notice this but a thread on the ML talk about this. according to this thread, swapping all OpenGL buffer together give best performance. Thank David Joint the modified 2007/9/19, arnaud houegbelo [EMAIL PROTECTED]: Hi Robert, Please find in attached file the source code of a small project based on osgViewerQT. This project create a QApplication with a mdi. You can open many OsgWidget (inherits of osgViewerQT) via the menu (File - Open). If you open many viewers you will see that the last viewers opened are very slow and if you close some previous viewers they delete some objects in the others viewers. I hope that this exemple will be useful to you to find the problem. many thanks and best Regards Arnaud Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow ___ 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] OpenSceneGraph with Qt multiple windowing problem
Oups forgotten I use Linux Fedore 7 Gcc 4.2.1 AMD Athlon(tm) XP 3200+ NVidia GForce 7600 GT OSG_THREADING = SingleThreaded OSG_OPTIMIZER = DEFAULT 2007/9/19, David Callu [EMAIL PROTECTED]: Hi arnaud I can't reproduce your problem. I have 4 osg window in the mainWindow and all have the same frame rate. Can you describe you plateform driver vertion OSG, Qt OSG_OPTIMIZE and OSG_CAMERA_THREAD env var ... another think is thit is preferable to use osgViewer::CompositeViewer and osgViewer::View instead of osgViewer::Viewer when you have many scene and so many view. With this, all update/cull/draw/ operations are done with the Thread Model choose in the osgViewer::CompositeViewer, and so do the best management of all update/cull/draw/ operation of each View. This include to swapping OpenGL buffer all together. I never could notice this but a thread on the ML talk about this. according to this thread, swapping all OpenGL buffer together give best performance. Thank David Joint the modified 2007/9/19, arnaud houegbelo [EMAIL PROTECTED]: Hi Robert, Please find in attached file the source code of a small project based on osgViewerQT. This project create a QApplication with a mdi. You can open many OsgWidget (inherits of osgViewerQT) via the menu (File - Open). If you open many viewers you will see that the last viewers opened are very slow and if you close some previous viewers they delete some objects in the others viewers. I hope that this exemple will be useful to you to find the problem. many thanks and best Regards Arnaud Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow ___ 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] OpenSceneGraph with Qt multiple windowing problem
On 9/19/07, David Callu [EMAIL PROTECTED] wrote: I can't reproduce your problem. I have 4 osg window in the mainWindow and all have the same frame rate. Can you describe you plateform driver vertion OSG, Qt OSG_OPTIMIZE and OSG_CAMERA_THREAD env var ... Thanks for looking in to this. another think is thit is preferable to use osgViewer::CompositeViewer and osgViewer::View instead of osgViewer::Viewer when you have many scene and so many view. With this, all update/cull/draw/ operations are done with the Thread Model choose in the osgViewer::CompositeViewer, and so do the best management of all update/cull/draw/ operation of each View. This include to swapping OpenGL buffer all together. I never could notice this but a thread on the ML talk about this. according to this thread, swapping all OpenGL buffer together give best performance. For apps that have multiple windows and mulitple views on to one or more scenes that CompositeViewer is the most apporpriate tool. There is but though, running with multiple graphics context is not possible when one use GraphicsWindowEmbedded - only single threaded, single context per Viewer/CompositeViewer is possible. If you have multiple Windows then you need a separate Viewer/CompositeViewer for each one. The ideal is not to have to use GraphicsWindowEmbedded and provide a full GraphicsWindow implementation for the specific windowing system - for instance a GraphicsWindowQt would be appropriate. I did originally have a bash at writing a GraphicsWindowQt but Qt didn't provide all the required hooks for controlling the OpenGL context in a way that a complete GraphcsWindowQt could be achieved - bascially Qt's OpenGL threading support isn't quite a capable/flexible as it should be. There other approach would be to inherit the native windowing into a GraphicsWindowWin32/Carbon/X11 in a way that adapts a Qt window via its native windowing implementation. There is a but in this... GraphicsWindowX11 does yet support windowing inheritance - but GraphicsWindowWin32 and Carbon do, so its all typically possible just lack of time at my end has hindered this. Others are welcome to chip in and implement window inheritance in GraphicsWindowX11 :-) Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph with Qt multiple windowing problem
Hi Arnaud, My guess is the context ID's are overlapping for the separate windows, resulting in sharing of texture objects and display lists. I'm not sure though, as I haven't tried this type of thing with QT. Could you modify the osgviewerQT example so that it creates windows/viewers in the same way as you have constructed so it reproduces the problems so that I and others can see it first hand and have a chance at pining it down. Robert. On 9/18/07, arnaud houegbelo [EMAIL PROTECTED] wrote: Hello, I develop different 3D viewers with Qt and OpenSceneGraph. I use the osgViewer exemple for Qt and It works fine. But I have a problem when I want to display many 3D viewer at the same time in the same QApplication.. It seems that there is an interaction between the different windows, because when I close a window some nodes are deleted in some of the others windows. I want to have multiple windowing system in my QApplication (many osgViewer at the same time) It is possible? Thanks in advance, Best Regrads Arnaud Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo..com/mobileweb/onesearch?refer=1ONXIC ___ 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] OpenSceneGraph with Qt multiple windowing problem
Hi Arnaud, I'm afraid I like others are very busy so if you can help by providing a modified osgviewerQT that we can easily compile and reproduce the problem then this will really help. Just post source to the osg-users list. Cheers, Robert. On 9/18/07, arnaud houegbelo [EMAIL PROTECTED] wrote: Hi Robert, I saw your answer about my problem OpenSceneGraph with Qt multiple windowing problem'. Many thanks for the reply. Can I send you an archive with source code to test it? Or if you want, I think it's simple for you to test it, you can take your osgViewerQT exemple and display many windows with different scene (display shape or geode etc...)in the same application. You'll can see what I mean. Many Thanks and Best regards Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos. http://autos.yahoo.com/index.html ___ 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