3
votes

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 these errors:

QGLShader::compile(Vertex): 0:1(10): error: GLSL 1.30 is not supported. Supported version are: 1.10, 1.20 and 1.00 ES
QGLShader::compile(Fragment): 0:1(10): error: GLSL 1.30 is not supported. Supported version are: 1.10, 1.20 and 1.00 ES

I think some keywords in my vertex and fragment shader files should be changed to old version. Could any one suggest me the old keywords.

Vertex Shader file:

#version 130

uniform mat4 mvpMatrix;

in vec4 vertex;
in vec2 textureCoordinate;

out vec2 varyingTextureCoordinate;

void main(void)
{
    varyingTextureCoordinate = textureCoordinate;
    gl_Position = mvpMatrix * vertex;
}

Fragment Shader file:

#version 130

uniform sampler2D texture;

in vec2 varyingTextureCoordinate;

out vec4 fragColor;

void main(void)
{
    fragColor = texture2D(texture, varyingTextureCoordinate);
}
1
Please give when someone answer a read and/or visit all topics in tour (that will give you a badge as well)rene

1 Answers

9
votes

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);
}