当前位置: 首页>>代码示例>>C++>>正文


C++ QOpenGLContext::setScreen方法代码示例

本文整理汇总了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);
    }
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:52,代码来源:qeglfswindow.cpp


注:本文中的QOpenGLContext::setScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。