Hello Benoit,

The only way i got QGraphicsView worked with OSG and still have the full functionality of both was:

1. make an offscreen graphic context for OSG
2. create a QGLWidget
3. share textures between those 2 contexts
4. set the viewport of QGraphicsView to the QGLWidget
5. find a way to sync both context so one does not access a texture that is the process of beeing rendered
6. Reuse shared texture in some way in QGraphicsScene

So far, i always had some problem with translucency and Qt whenever i tried to mix OSG somewhere. I suspect the backingstore of Qt but have not verified anything. Someone out there has
a deeper knowledge of Qt and might offer a solution/clue?


On 21/06/2011 10:03 AM, Benoit Morel wrote:
Hi everybody
ยจ
I'm using a Qt framework and i have to integrate an OSG widget to render a 3D 
scene, in a QGraphicsScene, but my code doesn't work.

(I'm using OQG 3.0 and i'm working on Windows XP)

I have seen on the forum that the example osgViewerQt can help to integrate OSG 
in a QWidget. I used it and it works when i just tried to render a QWidget (i 
modified it a little bit to display the cow only, not the pop-up window and the 
other .osg objets)
Then i used a QGraphicsProxyWidget to render my QWidget in the QGraphicsScene. 
This time, i just obtain a white rect in the window.

Here is my main: (ViewerWidget is the example class wich is also a QWidget)

Code:

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGraphicsView *view = new QGraphicsView(new QGraphicsScene());
QGraphicsProxyWidget* proxywidget = new QGraphicsProxyWidget();
proxywidget->setGeometry(QRect(0, 0, 800, 600));
QWidget *widget = new 
ViewerWidget(osgViewer::ViewerBase::CullDrawThreadPerContext);
widget->setGeometry(0, 0, 800, 600);
proxywidget->setWidget(widget);
view->scene()->addItem(proxywidget);
view->show();
return app.exec();
}




Did i do something wrong?
I'm not sure the example is adapted to use QGraphicsProxyWidget. In this case, 
is there any alternative solution to get a QGrapgicsObjet?

Thank you in advance

Cheers,
Benoit

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





_______________________________________________
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

Reply via email to