|
请问:
把cegui做的面板嵌入到QT里,
总是抛出异常:
OpenGLRenderer failed to initialise the GLEW library. Missing GL version"
这个问题在控制台程序里遇到过,加了下面的代码就好了:
setThreadingModel(osgViewer::Viewer::SingleThreaded);
realize();
makeCurrent();
但是在ViewerQT 里添加上述代码却没有用。
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);
realize();
makeCurrent();
connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL()));
_timer.start(10);
}
virtual void paintGL()
{
frame();
}
virtual void makeCurrent()
{
getCamera()->getGraphicsContext()->makeContextCurrent(this->_gw);
}
...
}
搞了一晚上,还没有头绪,晕死。
多谢帮助! |
|