Skip to content

mpv-examples - qt_opengl does not work with integrated graphics #66

Open
@patui

Description

@patui

mpv-examples - qt_opengl does not work with integrated graphics
My laptop has a discrete graphics card NVIDIA GeForce GTX 960M and an integrated graphics card HD Graphics 530.

Using the example https://github.com/mpv-player/mpv-examples/tree/master/libmpv/qt_opengl,

It works fine under the independent graphics card, but reports an error under the integrated graphics card:

D:\Workspace\Projects\CppTest\libmpvopengl-v2\cmake-build-release\untitled.exe
[cplayer] mpv v0.39.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
[cplayer] libplacebo version: v7.349.0 (v7.349.0-dirty)
[cplayer] FFmpeg version: n7.1
[cplayer] FFmpeg library versions:
[cplayer] libavcodec 61.19.100
[cplayer] libavdevice 61.3.100
[cplayer] libavfilter 10.4.100
[cplayer] libavformat 61.7.100
[cplayer] libavutil 59.39.100
[cplayer] libswresample 5.3.100
[cplayer] libswscale 8.3.100
[cplayer] Configuration: -Dbuildtype=release -Dlibmpv=true -Dbuild-date=false -Ddefault_library=shared -Dcplayer=false -
Dd3d-hwaccel=enabled -Dd3d9-hwaccel=enabled -Dd3d11=disabled -Ddirect3d=disabled -Dgl=enabled -Dgl-win32=enabled -Dvulka
n=disabled -Dspirv-cross=disabled -Dwin32-threads=enabled -Dwin32-smtc=disabled -Duwp=disabled -Dwasapi=enabled -Dwaylan
d=disabled -Dx11=disabled -Dxv=disabled -Dvaapi=disabled -Dvdpau=disabled -Dcaca=disabled -Djpeg=disabled -Dlua=disabled
-Drubberband=disabled -Dsdl2=disabled -Dsdl2-gamepad=disabled -Duchardet=disabled -Dvapoursynth=disabled -Dzimg=enabled
-Djavascript=disabled -Dlibarchive=disabled -Dlibbluray=disabled
[cplayer] List of enabled features: cplugins d3d-hwaccel d3d9-hwaccel dos-paths ffmpeg gl gl-dxinterop gl-dxinterop-d3d9
gl-win32 glob glob-win32 gpl iconv lcms2 libass libavdevice libplacebo pathcch shaderc vector wasapi win32 win32-deskto
p win32-threads zimg zimg-st428 zlib
Failed to make context current.
Failed to make context current.
QWindowsGLContext::makeCurrent: wglMakeCurrent() failed (Ч)
QRhiGles2: Failed to make context current. Expect bad things to happen.
Failed to create QRhi for QBackingStoreRhiSupport
Failed to make context current.
QWindowsGLContext::makeCurrent: wglMakeCurrent() failed (Ч)
QOpenGLWidget: Failed to make context current
Failed to make context current.
QWindowsGLContext::makeCurrent: wglMakeCurrent() failed (Ч)
QOpenGLWidget: Failed to make context current

Image

After setting this up, it works fine. qputenv("QT_OPENGL", "software");


#include "TestOpenGL.h"

TestOpenGL::~TestOpenGL()
{
}

void TestOpenGL::initializeGL()
{
    if (!initializeOpenGLFunctions()) {
        qWarning("Failed to initialize OpenGL functions!");
        return;
    }

    QOpenGLContext *context = QOpenGLContext::currentContext();
    if (context) {
        qDebug() << "OpenGL Version:" << context->format().majorVersion() << "." << context->format().minorVersion();
        qDebug() << "Renderer:" << QString((const char*)glGetString(GL_RENDERER));
        qDebug() << "Vendor:" << QString((const char*)glGetString(GL_VENDOR));
        qDebug() << "GLSL Version:" << QString((const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
    } else {
        qWarning() << "No OpenGL context available";
    }
}

void TestOpenGL::paintGL()
{
    QOpenGLWidget::paintGL();
}

debug is also ok.

D:\Workspace\Projects\CppTest\libmpvopengl-v2\cmake-build-release\untitled.exe
OpenGL Version: 4 . 6
Renderer: "Intel(R) HD Graphics 530"
Vendor: "Intel"
GLSL Version: "4.60 - Build 31.0.101.2111"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions