本文整理汇总了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;
}
示例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;
}
示例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;
}