java - LWJGL Vertex and Fragment Shaders Wont Compile (Error CO206) -


i have been interested in learning opengl while. every time start working it, same error when compiling shaders. error code spits out.

0(1) : error c0206: invalid token "invalid atom 483265304" in version line

i have tried looking error , haven't found of anything... , nothing provided incite on how fix problem.

i not know c or c++ using lwjgl.

here code i'm using compile shaders:

private static int loadshader(string file, int type){     //system.out.println("loading shader.");     stringbuilder shadersource = new stringbuilder();     try {         bufferedreader reader = new bufferedreader(new filereader(file));         string line;         while((line = reader.readline())!=null){             //system.out.println(line);             shadersource.append(line).append("/n");         }         reader.close();         //system.out.println("closed reader.");      } catch (ioexception e) {         system.err.println("could not read file!");         e.printstacktrace();         system.exit(-1);     }     //system.out.println("creating shader id...");     int shaderid = gl20.glcreateshader(type);     //system.out.println("created shader id, compiling shader.");     gl20.glshadersource(shaderid, shadersource);     gl20.glcompileshader(shaderid);      if (gl20.glgetshaderi(shaderid, gl20.gl_compile_status) == gl11.gl_false){         system.out.println(gl20.glgetshaderinfolog(shaderid, 500));         system.err.println("could not compile shader. location: " + file);         system.exit(-1);     }     return shaderid; } 

this vertex shader:

#version 400 core  in vec3 position; out vec3 colour;  void main(void){      gl_position = vec4(position, 1.0);     colour = vec3(position.x+0.5, 1.0, position.y+0.5); } 

and fragment shader:

#version 400 core  in vec3 colour; out vec4 out_colour;  void main(void){     out_colour = vec4(colour, 1.0); } 

if reads this, in advance time.

basic typo - you're appending "/n" instead of "\n" when read in each line.

@nicol bolas makes point - there function files.readallbytes(path path), if use instead of re-implementing functionality less prone little bugs this.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -