Search code examples
openglglsllwjgl

Compilation errors using shaders


My application is returning an error:

Fragment shader failed to compile with the following errors:
ERROR: 0:5: error(#132) Syntax error: 'out' parse error
ERROR: error(#273) 1 compilation errors.  No code generated

whenever I execute the following code:

fragment.fs

#version 330

in vec4 color

out vec4 fragColor;

void main() {
    fragColor = color;
}

vertex.vs

#version 330

layout (location = 0) in vec3 position;

out vec4 color;

uniform float uniformFloat;

void main() {
    color = vec4(clamp(position, 0.0, 1.0), 1.0);
    gl_Position = vec4(position, 1.0);
}

How could I fix this?


Solution

  • You forgot the semicolon after in vec4 color in the fragment shader.