本文整理汇总了C++中QOpenGLContext::setScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ QOpenGLContext::setScreen方法的具体用法?C++ QOpenGLContext::setScreen怎么用?C++ QOpenGLContext::setScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QOpenGLContext
的用法示例。
在下文中一共展示了QOpenGLContext::setScreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
void QEglFSWindow::create()
{
if (m_flags.testFlag(Created))
return;
QEGLPlatformWindow::create();
m_flags = Created;
if (window()->type() == Qt::Desktop)
return;
// Stop if there is already a window backed by a native window and surface. Additional
// raster windows will not have their own native window, surface and context. Instead,
// they will be composited onto the root window's surface.
QEglFSScreen *screen = this->screen();
if (screen->primarySurface() != EGL_NO_SURFACE) {
if (isRaster() && screen->compositingWindow())
return;
#if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK)
// We can have either a single OpenGL window or multiple raster windows.
// Other combinations cannot work.
qFatal("EGLFS: OpenGL windows cannot be mixed with others.");
#endif
return;
}
m_flags |= HasNativeWindow;
setGeometry(QRect()); // will become fullscreen
QWindowSystemInterface::handleExposeEvent(window(), geometry());
EGLDisplay display = static_cast<QEglFSScreen *>(screen)->display();
QSurfaceFormat platformFormat = QEglFSHooks::hooks()->surfaceFormatFor(window()->requestedFormat());
m_config = QEglFSIntegration::chooseConfig(display, platformFormat);
m_format = q_glFormatFromConfig(display, m_config, platformFormat);
resetSurface();
screen->setPrimarySurface(m_surface);
if (isRaster()) {
QOpenGLContext *context = new QOpenGLContext(QGuiApplication::instance());
context->setFormat(window()->requestedFormat());
context->setScreen(window()->screen());
if (!context->create())
qFatal("EGLFS: Failed to create compositing context");
screen->setRootContext(context);
screen->setRootWindow(this);
}
}