Hello! I'm stuck on one problem.
There is kind of big project, and I need to make Qt interface on it. What I try to do is make a camera for Qt-interface element. The problem comes with using OpenThreads: I'm trying to run OSG rendering inside new thread, yielding to rendering of Qt element, like in osgQtBrowser example. First, I create class to handle thread creating: Code: class ViewerFrameThread : public OpenThreads::Thread { public: ViewerFrameThread(osgViewer::ViewerBase* viewerBase, bool doQApplicationExit): _viewerBase(viewerBase), _doQApplicationExit(doQApplicationExit) {} ~ViewerFrameThread() { cancel(); while(isRunning()) { OpenThreads::Thread::YieldCurrentThread(); } } int cancel() { _viewerBase->setDone(true); return 0; } void run() { int result = _viewerBase->run(); if (_doQApplicationExit) QApplication::exit(result); } osg::ref_ptr<osgViewer::ViewerBase> _viewerBase; bool _doQApplicationExit; }; Then I try to run my viewer using it: Code: ViewerFrameThread frameThread(m_viewer.getViewerBase()); frameThread.startThread(); return QApplication::exec(); And here comes problem: if I use "frameThread.startThread()" like in example, my project gives me access violation, like every try in new place. Otherwise, if I use "frameThread.run()", everything runs OK but Qt button isnt getting rendered (just a white block in the corner of the screen) I've tried to make a simply application with just model and Qt-button, and everything works fine with ".startThread()", as button doesnt get rendered with ".run()" same as in my big project. Could not find any documentation of OpenThreads. :( So the question is, like: is it possible to render Qt thingy with ".run()", or what can possibly cause Access Violation with ".startThread()"? I'm sorry if the explanation wasnt very clear, though hopefully someone can help :) Thanks in advance! Cheers, Max ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=50049#50049 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org