Search code examples
openglglsllwjgl

LWJGL GLSL shader not compiling


I am using the lastest recomended version of LWJGL 3, and while trying to compile shaders i get errors.

Shader:

#version 330

in vec2 position;

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

Error:

Vertex shader failed to compile with the following errors:
ERROR: 0:1: error(#307) Invalid profile "in"
ERROR: 0:1: error(#76) Syntax error: unexpected tokens following #version
ERROR: 0:1: error(#364) Invalid: unexpected token in symbol.
ERROR: error(#273) 3 compilation errors.  No code generated

I wasnt able to find anything related to this error online. Does anyone here know?


Solution

  • Looks as if the end of line characters (\n) are missing in the code string which means that the compiler treats the in keyword as profile qualifier for the #version directive.