在realize()前打开预编译选项指令:
osg::DisplaySettings::instance()->setCompileContextsHint(true);
mpr_osgviewer->realize();
显示如下信息:
此时虽然trait::shareContext变量有了值,但是实际上其共享渲染描述表句柄hglrc是没有创建成功的。
我试图自己创建opengl图形共享上下文hglrc以实现多线程预编译显示列表,避免帧冲击,可惜无法成功。
osg::GraphicsContext* gc = mpr_osgviewer->getCamera()->getGraphicsContext();
osgViewer::GraphicsWindowWin32* gw = dynamic_cast<:graphicswindowwin32>(gc);
if (gw)
{
HGLRC _sharehglrc = 0;
bool succ = gc->makeCurrent();
HGLRC hglrc = gw->getWGLContext();
bool succ2 = ::wglShareLists(hglrc,_sharehglrc);
succ2返回值是false,wglShareLists失败,_sharehglrc仍然为空。
查询了本机的GL_VERSION&#x