Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-09 Thread Jean-Sébastien Guay

Hi Ben,


BTW, I've been using the OSGAdapterWidget ... trying to specify
sharedContext with traits.


AdapterWidget will force you to single-threaded mode, which will make 
using multiple views painfully slow. QOSGWidget supports the normal OSG 
multi-threading modes, which is much better.



I've looked at all the OSG examples as well as some Delta3D examples,
but I can't find one that is Qt based and sharing the graphics context
and a single scene.


OK, I hadn't understood that you wanted to share the graphics context. 
We're creating a new context for each view. It works OK for us. I don't 
know if it would work or how to do it when sharing the context (I've 
never tried).


Sorry I can't help more.

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-09 Thread Ben Cain
Thanks J-S,

I think I have it working now.  Although, like you said, the adapter
widget will force me to use single-threading mode.  My real goal is to
have one scene with shared textures, etc. (in shared context) used
across multiple windows in a QWorkspace.

I wish there was a osgQt library of sorts ... rather than having to
tweak example code to get the OSG/Qt support.

The Delta3D community provides some Qt/OSG help with their dtQt
library.  I think it grew out of the Delta3D STAGE development effort
(having followed it's code somewhat).  They mentioned submitting some
of this back to OSG.  Here's hoping.

Cheers,
   Ben
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-09 Thread Jean-Sébastien Guay

Hi Ben,


I wish there was a osgQt library of sorts ... rather than having to
tweak example code to get the OSG/Qt support.


Funny you should mention it, there is now :-)

http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgQt

It has some utility classes for fonts and such, but eventually Robert 
wants to have a full-fledged GraphicsWindow implementation for Qt so 
that apps can use that directly instead of starting from the examples 
and possibly diverging wildly from there...


Feel free to contribute to that goal if you want :-)

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-09 Thread Ben Cain
On 4/9/10, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote:
 Hi Ben,

 I wish there was a osgQt library of sorts ... rather than having to
 tweak example code to get the OSG/Qt support.

 Funny you should mention it, there is now :-)


KUDOS!!!  :)   Whoo hoo!

Btw, I have a great deal of Qt experience.  I'll definitely do what I
can to contribute back.

I've actually been using Qt for quite a while too, but have struggled
at times with the Qt/OSG and Qt/Delta3D integration.

Cheers,
   Ben
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] CompositeViewer and multiple QGLWidgets

2010-04-08 Thread Ben Cain
Can osgViewer::CompositeViewer be used to manage views in different QGLWidgets?

I'm trying to develop an application with a CAD-like interface ...
showing multiple views of the same scene (e.g. MDI look-and-feel).  In
this case, the context is to be shared across all the views ...
referencing just one scene.

Each view should be able to have it's own camera manipulator, event
handlers, etc.

Any help much appreciated!

Cheers,
   Ben
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-08 Thread Martin Beckett
Haven't tried composite view but i use multiple OSGWidgets with QDockWidgets to 
make an MDI app 

The 
nice thing about dockwidgets is that you can move them outside the app and so 
use multiple monitors effectively.

Martin

 
This is how I use it, with dockwindows in a Qt app
_views is a vector of ViewerQt so I can manipulate the settings in each window 
easily
_scene is the root of my OSG model
 
ViewerQT is just a wrapper around the QOSGWidget example
It also uses a customized version of spherical manipulator that is more 
suitable for GIS type apps (allows you to switch views to N,E,S,W plan)
but you can just strip out the setHomeMode() parts if you want to use the 
standard one.
 
This is how I use it, with dockwindows in a Qt app
_views is a vector of ViewerQt so I can have different settings in each window
_scene is the root of my OSG model
 

Code:
void MainWindow::createView()
{
QString name=QString(View%1).arg(_views.size()+1);

QDockWidget *dock = new QDockWidget(name, this);
_view = new Viewer(dock);
_view-setGeometry(dock-geometry());
dock-setObjectName(name);
dock-setWidget(_view);
 
if ( _views.empty() ) {
// first one can't be closed
dock-setFeatures(0);
} else{
dock-setFeatures(QDockWidget::AllDockWidgetFeatures);
}
 
_views.push_back(_view);

   addDockWidget(Qt::RightDockWidgetArea, dock);
 
if ( _scene ) {
_view-setSceneData(_scene-getRoot());
_view-show();
_view-ViewCentre();
}
 
if ( _views.size()  1 ) {
tabifyDockWidget(_docks.back(),dock);
}
_docks.push_back(dock); 
_view-getCamera()-setCullMask(0xff);

}



--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26604#26604




Attachments: 
http://forum.openscenegraph.org//files/viewerqt_974.zip


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-08 Thread Jean-Sébastien Guay

Hi Ben,


Can osgViewer::CompositeViewer be used to manage views in different QGLWidgets?


We use osgViewer::CompositeViewer with multiple instances of a widget 
similar to QOSGWidget (see the osgViewerQT example) to do what you're 
talking about.


We can either split one widget into 1x1, 1x2, 2x1 or 2x2 configuration, 
or we can spawn new floating widgets that are a Qt window with a 
QOSGWidget in them, with a view in the same CompositeViewer. Being 
separate views in the CompositeViewer, it automatically follows that 
each one has a separate camera manipulator, event handlers, etc. as you 
require.


The one thing we're having trouble with is the fact that OSG writes into 
its graphics context whenever it wants, and doesn't necessarily let QT 
know about it, so overlaying other widgets over the QOSGWidget doesn't 
work very well (they get erased and flicker). And you have to be careful 
to make sure OSG's threading and QT's threading don't trip each other up 
(make each other wait around doing nothing)...


But apart from those gotchas, it works well.

I don't have specific code to share, but it should be pretty easy to 
start with the osgViewerQT example and work it into a tech demo of what 
you're after.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CompositeViewer and multiple QGLWidgets

2010-04-08 Thread Ben Cain
Guys, much thanks for the inputs!  I am getting very confused with
shared context using Qt and OSG.  I've done this many times over the
years with straight OpenGL ... just too stupid tonight to figure out
what I'm messing up.

BTW, I've been using the OSGAdapterWidget ... trying to specify
sharedContext with traits.

Unfortunately, everything except the first view is outside of its
parent Qt widget (that is in a QWorkspace) ... odd.  It shows up on
the main desktop with no window decorations.  Probably not describing
this well.  Sorry, it's late.

I've looked at all the OSG examples as well as some Delta3D examples,
but I can't find one that is Qt based and sharing the graphics context
and a single scene.

Do you have a simple example?  I'd give a weeks salary :)
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org