Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

OpenGL ES and large textures



  • Greetings Qt enthusiasts,

    I'm on Windows 10 with Qt 5.11.1.

    I'm building this video browser with Qt + libVLC and recently switched to the OpenGL ES backend:

    QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
    

    Coming from the Desktop OpenGL backend I immediately noticed how faster it was at resizing windows, and it felt like the proper way to go.

    Unfortunately when playing a 1440p video the CPU usage increases and the rendering gets slower, like way slower than classic OpenGL. Is there a flag or some configuration to alter OpenGL ES behavior with larger textures that update frequently.

    PS: my player is based on vertex and fragment shaders for rendering (https://github.com/omega-gg/Sky/blob/master/src/SkMedia/src/media/WBackendVlc.cpp#L371).



  • For the record here are the shaders I'm currently using:

    /* virtual */ const char * WBackendVlcShader::vertexShader() const
    {
        return "#version 100\n"
    
               "attribute highp vec4 vertex;"
               "attribute highp vec2 fragment;"
    
               "uniform highp mat4 position;"
    
               "varying highp vec2 vector;"
    
               "void main()"
               "{"
                   "gl_Position = position * vertex;"
    
                   "vector = fragment;"
               "}";
    }
    
    /* virtual */ const char * WBackendVlcShader::fragmentShader() const
    {
        return "#version 100\n"
    
               "uniform sampler2D y;"
               "uniform sampler2D u;"
               "uniform sampler2D v;"
    
               "uniform mediump mat4 matrix;"
    
               "varying highp vec2 vector;"
    
               "uniform lowp float opacity;"
    
               "void main()"
               "{"
                   "highp vec4 color = vec4(texture2D(y, vector.st).r,"
                                           "texture2D(u, vector.st).r,"
                                           "texture2D(v, vector.st).r, 1.0);"
    
                   "gl_FragColor = matrix * color * opacity;"
               "}";
    }
    

Log in to reply