On 6.3.2013 9:36, Gianni Ambrosio wrote:
Hi Robert,
then there is something missing somewhere or a mistake from my side.
I derived from osgQT::GLWidget to have a QGLWidget to insert in my GUI.
The usual way to get to the osgQT::GLWidget is something like this:
osg::ref_ptr<osgQt::GraphicsWindowQt> gwQt = new
osgQt::GraphicsWindowQt( traits.get() );
camera->setGraphicsContext( gwQt.get() );
osgQt::GLWidget* glWidget = gwQt->getGLWidget();
// insert glWidget into GUI here
If you must derive from osgQT::GLWidget then you will need to pass your
custom GL widget to the GraphicsWindowQt constructor through
GraphicsContext::Traits::inheritedWindowData or call GraphicsWindowQt
constructor with your custom widget:
traits->inheritedWindowData = new osgQT::GraphicsWindowQt::WindowData(
myCustomGLWidget );
osg::ref_ptr<osgQt::GraphicsWindowQt> gwQt = new
osgQt::GraphicsWindowQt( traits.get() );
// osg::ref_ptr<osgQt::GraphicsWindowQt> gwQt = new
osgQt::GraphicsWindowQt( myCustomGLWidget );
camera->setGraphicsContext( gwQt.get() );
// insert myCustomGLWidget into GUI here
I would first check if GLWidget/GraphicsWindow/Camera setup is done
correctly.
When the application starts I basically add an osgWidget::Widget (or even a
osgWidget::Label) to an osgWidget::WindowManager. The problem is that all
widgets have a small size even if the resizeEvent implementation of
osgQt::GLWidget is executed. Only when I resize the Qt window containing the
osgQt::GLWidget and the resizeEvent in executed again, the widgets are
correctly resized.
On the other side if I resize the Qt window "before" adding widgets to the
osgWidget::WindowManager then, in this case, widgets are correctly shown immediately.
I'm sorry but at the moment I don't have a simple example.
If the GraphicsWindowQt *did pick the resize event* maybe all you need
is to call viewer->frame() for the events to be processed by the osg.
Also try with viewer->setRunFrameScheme(ON_DEMAND). This will prevent
osg to discard accumulated events picked outside the predefined time frame.
Robert Milharcic
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org