Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Got a real annoying problem here.

My shader program compiles fine on my Ati Radeon HD card, but on Nvidia and Intel it failes to compile.

Vertex shader:

#version 120
attribute vec3 in_position;
 attribute vec3 in_normal;
 attribute vec3 in_texcoord;

 uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projMatrix;

varying vec2 texture_coordinate;
varying vec3 normal;

void main()
{
gl_Position = (projMatrix * viewMatrix * modelMatrix) * vec4(in_position, 1.0);
normal = in_normal;
texture_coordinate = in_texcoord.xy;
}

Fragment shader:

#version 120
varying vec2 texture_coordinate;
varying vec3 normal;

uniform sampler2D gColorMap;

 void main()
 {
   gl_FragData[0] = vec4(texture(gColorMap, texture_coordinate).xyz, 1.0f);
   gl_FragData[1] = vec4(normalize(normal), 1.0f);
}

Any ideas? I checked the shader for errors, but I can't find anything. Thanks.

share|improve this question
    
I haven't worked with OpenGL for some longer time. But I think attributes are available from version 130, aren't they? –  Miro Jun 10 '13 at 12:05
    
Yup, that's it. Changed it to 130 and it now works fine :) Please add an answer so I can mark it. –  Basaa Jun 10 '13 at 13:25
    
OK, thank you :) –  Miro Jun 10 '13 at 14:09
3  
What errors were you getting? –  Nicol Bolas Jun 10 '13 at 17:36
add comment

1 Answer

up vote 8 down vote accepted

The GLSL function texture and the output gl_FragData are only available in GLSL version 1.30 or better.

So, change line #version 120 to #version 130

To find compile problems you should use glGetShaderInfoLog and glGetProgramInfoLog

share|improve this answer
    
Yep, thank you :) –  Basaa Jun 10 '13 at 14:16
    
You're welcome. I'm glad I helped you :) –  Miro Jun 10 '13 at 14:18
    
Thanks for the clarification Nicol. –  Basaa Jun 10 '13 at 23:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.