Can't compile opengl es 3.0 shader on PC.



  • Qt version: 5.6
    opengl es version: 3.0
    platform: opensuse 42.2 on vmware workstarion 14.

    fshader:

    #version 300 es
    precision mediump float;
    
    out vec4 fragColor;
    
    void main()
    {
        fragColor = vec4(1.0, 0.5, 0.5, 1.0);
    }
    

    In main() I add:

        QSurfaceFormat fmt;
        fmt.setVersion(3, 0);
        fmt.setDepthBufferSize(24);
        QSurfaceFormat::setDefaultFormat(fmt);
    

    glxinfo |grep version outputs:

    server glx version string: 1.4
    client glx version string: 1.4
    GLX version: 1.4
        Max core profile version: 3.3
        Max compat profile version: 3.0
        Max GLES1 profile version: 1.1
        Max GLES[23] profile version: 3.0
    OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.2
    OpenGL core profile shading language version string: 3.30
    OpenGL version string: 3.0 Mesa 11.2.2
    OpenGL shading language version string: 1.30
    OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.2.2
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
    

    fshader compile Error:

    QOpenGLShader::compile(Fragment): 0:3(13): error: syntax error, unexpected FLOAT_TOK, expecting LOWP or MEDIUMP or HIGHP
    
    *** Problematic Fragment shader source code ***
    //#version 330 core
    #version 300 es
    #define lowp
    #define mediump
    #define highp
    #line 3
    precision mediump float;
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.