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


C++ MythMainWindow::GetRenderDevice方法代码示例

本文整理汇总了C++中MythMainWindow::GetRenderDevice方法的典型用法代码示例。如果您正苦于以下问题:C++ MythMainWindow::GetRenderDevice方法的具体用法?C++ MythMainWindow::GetRenderDevice怎么用?C++ MythMainWindow::GetRenderDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MythMainWindow的用法示例。


在下文中一共展示了MythMainWindow::GetRenderDevice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetupContext

bool VideoOutputOpenGL::SetupContext(void)
{
    QMutexLocker locker(&gl_context_lock);

    if (gl_context)
    {
        LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Re-using context"));
        return true;
    }

    MythMainWindow* win = MythMainWindow::getMainWindow();
    if (!win)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to get MythMainWindow");
        return false;
    }

    gl_context = dynamic_cast<MythRenderOpenGL*>(win->GetRenderDevice());
    if (gl_context)
    {
        gl_context->IncrRef();
        LOG(VB_PLAYBACK, LOG_INFO, LOC + "Using main UI render context");
        return true;
    }

    // This code does not work.
    // Using OpenGL video renderer with QT Theme painter - the moment
    // the code below calls gl_context->create() the main window disappears
    // and after that the video renderer complains about rendering on a non
    // visible window. The window never comes back and you have to kill
    // the frontend.

/*
    QWidget *device = QWidget::find(gl_parent_win);
    if (!device)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to find parent to windowID");
        return false;
    }

    gl_context = MythRenderOpenGL::Create(QString(), device);
    if (gl_context && gl_context->create())
    {
        gl_context->Init();
        LOG(VB_GENERAL, LOG_INFO, LOC + "Created MythRenderOpenGL device.");
        return true;
    }

    LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create MythRenderOpenGL device.");
    if (gl_context)
        gl_context->DecrRef();
    gl_context = nullptr;
*/
    LOG(VB_GENERAL, LOG_ERR, LOC + "Unable to use OpenGL when ThemePainter is set to QT.");
    return false;
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:56,代码来源:videoout_opengl.cpp

示例2: SetupContext

bool VideoOutputOpenGL::SetupContext(void)
{
    QMutexLocker locker(&gl_context_lock);

    if (gl_context)
    {
        LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Re-using context"));
        return true;
    }

    MythMainWindow* win = MythMainWindow::getMainWindow();
    if (!win)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to get MythMainWindow");
        return false;
    }

    gl_context = dynamic_cast<MythRenderOpenGL*>(win->GetRenderDevice());
    if (gl_context)
    {
        gl_context->UpRef();
        LOG(VB_PLAYBACK, LOG_INFO, LOC + "Using main UI render context");
        return true;
    }

    QGLFormat fmt;
    fmt.setDepth(false);

    QGLWidget *device = (QGLWidget*)QWidget::find(gl_parent_win);
    if (!device)
    {
        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to cast parent to QGLWidget");
        return false;
    }

    gl_context = MythRenderOpenGL::Create(fmt, device);
    if (gl_context && gl_context->create())
    {
        gl_context->Init();
        LOG(VB_GENERAL, LOG_INFO, LOC + "Created MythRenderOpenGL device.");
        return true;
    }

    LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create MythRenderOpenGL device.");
    if (gl_context)
        gl_context->DownRef();
    gl_context = NULL;
    return false;
}
开发者ID:gdenning,项目名称:mythtv,代码行数:49,代码来源:videoout_opengl.cpp

示例3: Create

    bool Create(void)
    {
        m_x_disp = OpenMythXDisplay();
        if (!m_x_disp)
            return false;

        MythXLocker locker(m_x_disp);

        if (m_va_disp_type == kVADisplayGLX)
        {
            MythMainWindow *mw = GetMythMainWindow();
            if (!mw)
                return false;
            MythRenderOpenGL *gl =
                static_cast<MythRenderOpenGL*>(mw->GetRenderDevice());
            if (!gl)
            {
                LOG(VB_PLAYBACK, LOG_ERR, LOC +
                    QString("Failed to get OpenGL context - you must use the "
                            "OpenGL UI painter for VAAPI GLX support."));
                return false;
            }

            gl->makeCurrent();
            Display *display = glXGetCurrentDisplay();
            gl->doneCurrent();

            m_va_disp = vaGetDisplayGLX(display);
        }
        else
        {
            m_va_disp = vaGetDisplay(m_x_disp->GetDisplay());
        }

        if (!m_va_disp)
        {
            LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create VADisplay");
            return false;
        }

        int major_ver, minor_ver;
        INIT_ST;
        va_status = vaInitialize(m_va_disp, &major_ver, &minor_ver);
        CHECK_ST;

        if (ok)
            m_driver = vaQueryVendorString(m_va_disp);

        static bool debugged = false;
        if (ok && !debugged)
        {
            debugged = true;
            LOG(VB_GENERAL, LOG_INFO, LOC + QString("Version: %1.%2")
                                        .arg(major_ver).arg(minor_ver));
            LOG(VB_GENERAL, LOG_INFO, LOC + QString("Driver : %1").arg(m_driver));
        }
        if (ok)
        {
            LOG(VB_PLAYBACK, LOG_INFO, LOC +
                QString("Created VAAPI %1 display")
                .arg(m_va_disp_type == kVADisplayGLX ? "GLX" : "X11"));
        }
        return ok;
    }
开发者ID:mojie126,项目名称:mythtv,代码行数:64,代码来源:vaapicontext.cpp


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