使用着色器编译错误

时间:2013-07-13 20:43:21

标签: opengl glsl lwjgl

我的应用程序返回错误:

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

每当我执行以下代码时:

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

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:8)

您在片段着色器中in vec4 color后忘记了分号。

相关问题