标签:phi div graphic getc rap lag nim use ilb
VC3DGraphicsWindowQt::VC3DGraphicsWindowQt(QWidget* parent, Qt::WindowFlags f) { osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::setNotifyLevel(osg::NotifySeverity::FATAL); _traits = new osg::GraphicsContext::Traits(); _traits->windowDecoration = false; _traits->x = 0; _traits->y = 0; _traits->width = 100; _traits->height = 100; _traits->doubleBuffer = true; if (ds) { _traits->alpha = ds->getMinimumNumAlphaBits(); _traits->stencil = ds->getMinimumNumStencilBits(); _traits->sampleBuffers = ds->getMultiSamples(); _traits->samples = ds->getNumMultiSamples(); } if (parent) { _traits->width = parent->width(); _traits->height = parent->height(); } // create widget if it does not exist if (!m_opengl_widget) { // WindowFlags Qt::WindowFlags flags = f | Qt::Widget; // create widget m_opengl_widget = new VC3DQtOSGWidget(parent, flags); } m_opengl_widget->setMouseTracking(true); m_opengl_widget->setFocusPolicy(Qt::WheelFocus); m_opengl_widget->setGraphicsWindow(this); useCursor(_traits->useCursor); // initialize State setState(new osg::State); getState()->setGraphicsContext(this); // initialize contextID if (_traits.valid() && _traits->sharedContext.valid()) { getState()->setContextID(_traits->sharedContext->getState()->getContextID()); incrementContextIDUsageCount(getState()->getContextID()); } else { getState()->setContextID(osg::GraphicsContext::createNewContextID()); } // make sure the event queue has the correct window rectangle size and input range #if (OPENSCENEGRAPH_MAJOR_VERSION == 3) && (OPENSCENEGRAPH_MINOR_VERSION == 2) getEventQueue()->syncWindowRectangleWithGraphcisContext(); #else getEventQueue()->syncWindowRectangleWithGraphicsContext(); #endif }
标签:phi div graphic getc rap lag nim use ilb
原文地址:https://www.cnblogs.com/herd/p/11257278.html