Hi YangXiao,
I've seen in some previous thread that if you want to make multiple
threading schema work, you have to use the QOSGWidget instead of the
AdapterWidget. Don't ask me why as I don't know anything about it.
Hope I could help.



On Mon, May 11, 2009 at 4:05 AM, YangXiao <[email protected]> wrote:

> Hi everyone
>  In QTOSG example,When i modify the thread model to
> osgViewer::Viewer::DrawThreadPerContext); I get a runtime error!
>
> class ViewerQT : public osgViewer::Viewer, public AdapterWidget
> {
> public:
>  ViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget *
> shareWidget = 0, WindowFlags f = 0):
>    AdapterWidget( parent, name, shareWidget, f )
>    {
>     getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
>     getCamera()->setProjectionMatrixAsPerspective(30.0f,
> static_cast<double>(width())/static_cast<double>(height()), 1.0f, 10000.0f);
>     getCamera()->setGraphicsContext(getGraphicsWindow());
>     setThreadingModel(osgViewer::Viewer::SingleThreaded);
>     //setThreadingModel(osgViewer::Viewer::DrawThreadPerContext);  //here i
> modify
>           addEventHandler(new osgGA::StateSetManipulator );
>     connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL()));
>     _timer.start(10);
>    }
>    virtual void paintGL()
>    {
>     frame();
>    }
> protected:
>  QTimer _timer;
> };
>
> Thanks YangXiao.
>
> ------------------------------
> 好玩贺卡等你发,邮箱贺卡全新上线!<http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Loïc Simon
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to