[osg-users] osg-users Digest, Vol 9, Issue 73
Sohaib Athar
sohaibathar at yahoo.com
Wed Mar 26 18:35:44 PDT 2008
Hello Julian,
I'm sharing the same scene with 3 Qt4 widgets without
problems in an application. (Qt 4.3.1 + VS.NET 2003 )
In an earlier version of OSG, I remember doing
something like
getSceneView()->getState()->setContextID(contextID);
with unique contextIDs assigned to each of your
widgets.
Right now, what we are doing (this code is not written
by me) is something along the lines of:
class OneOfYourWidgetsClass : public QGLWidget, public
osgViewer::Viewer
{
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded>
_gw;
...
in its constructor we have:
_gw = new
osgViewer::GraphicsWindowEmbedded(0,0,width(),height());
...
along with code that starts the QTimer
connect(&_timer, SIGNAL(timeout()), this,
SLOT(updateGL()));
_timer.start();
In its initializeGL() we have:
getCamera()->setGraphicsContext(getGraphicsWindow());
where getGraphicsWindow returns _gw.get()
The application creates and displays objects of 3 or 4
different classes using this mechanism, each with its
own widget. You can look up the classes/functions
mentioned above, it should hopefully solve your
problem.
Best,
Sohaib.
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the osg-users
mailing list