GLSL 1.30 is not supported

后端 未结 1 544
情深已故
情深已故 2021-01-20 08:43

I have run my gl program successfully on my ubuntu system with a good graphics card. However, when I run it in an old intel machine with graphics mobile 4-series, I get thes

1条回答
  •  借酒劲吻你
    2021-01-20 09:07

    Run the feature deprecation list on page 2 of the GLSL 1.30 spec backwards:

    • #version 130 -> #version 120
    • in -> attribute
    • out -> varying
    • Remove fragColor declaration, replace fragColor usage with gl_FragColor

    Vertex shader:

    #version 120
    uniform mat4 mvpMatrix;
    attribute vec4 vertex;
    attribute vec2 textureCoordinate;
    varying vec2 varyingTextureCoordinate;
    void main(void)
    {
        varyingTextureCoordinate = textureCoordinate;
        gl_Position = mvpMatrix * vertex;
    }
    

    Fragment shader:

    #version 120
    uniform sampler2D texture;
    varying vec2 varyingTextureCoordinate;
    void main(void)
    {
        gl_FragColor = texture2D(texture, varyingTextureCoordinate);
    }
    

    0 讨论(0)
提交回复
热议问题