I have MacBook pro with Radeon HD6750, MacOS 10.7.5 and I found that it should support OpenGL 3.2 and GLSL 1.5 proof. Unfortunately, when I try to build one thirdparty application with shaders (OpenVDB viewer), it returns that my hardware doesn't support #version 130
. The code is below:
mShader.setVertShader(
"#version 130\n
"in vec3 vertex;\n"
"in vec3 color;\n"
"out vec4 f_color;\n"
"void main() {\n"
"f_color = vec4(color, 1.0);\n"
"gl_Position = gl_ModelViewProjectionMatrix * vec4(vertex, 1.0);}\n");
//check that it is shader and add source
glCompileShader(mVertShader);
char buffer[256];
int l = 0;
glGetShaderInfoLog(mVertShader, 256, &l, buffer);
if(GL_NO_ERROR != glGetError()) throw "Error: Unable to compile vertex shader.";
I installed OpenGL Extension viewer and it informs me that Shading language version is 1.20 and OpenGL version is 2.1 (fully supported, some features from 3.2 are available). I don't want to use GLSL 1.2 if my hardware is able to support a newer version. Do you have an idea what's wrong with my drivers/hardware and how I can fix this problem?
#version 130
specifies the shader is for use with OpenGL 3.0, and will cause an error if used with another version. You could modify the version number in your shader to 150, but you will still probably run into errors, and this shader uses compatibility profile features (namelygl_ModelViewProjectionMatrix
), and Mac OS X only supports OpenGL 3.2 core profile. Now, this shader doesn't do much advanced work, so you drop to version 1.20 (#version 120
), but you'd also need to change the keywords: "in" -> "attribute", "out" -> "varying" – radical7