Shader Compile Error

I just finished writing my first GLSL program. I wrote it in RenderMonkey and it got no errors there. However when I went to compile it in my application, I got “Error: 0:1: ‘pre-mature EOF’ : syntax error parse error” for both the vertex and fragment shader.

I’m assuming the 0:1 is a line number, but I can’t find any kind of reference on shader compile errors. If it is a line number the first line of each program is //. I’m running an ATI Radeon 9600 with the latest Catalyst drivers, and using the OpenGL 2.0 function calls and not the ARB.

Does anybody know what’s wrong here?

i don’t have the solution for your problem but can you tell me how did you get this message ?
(i also have a problem with my shader which works with renderMonkey but not in my opengl program)

you are probably including the EOF (End of File) tag with the shader source you supply to OpenGL. (ie. you are probably reading from file)

So simply pass the length of the actual text (excluding the EOF character)

I think you should type a ENTER at the end of you source code’s file.
This is good idea and also is a very good habit

It sounds like you’re reading the file line by line, then adding the lines together, but forgetting the ’
', so the entire shader ends up on a single line. So that // on the first line comments out the entire shader.

I was debugging another guy’s problem once, and throwing in // in the code would cause exactly that problem. Took me quite a while to figure out what went wrong. :slight_smile:

airseb: I got the error message by trying to compile each shader then calling glGetShaderInfoLog to get the infolog.

stanlylee: I already put the extra line, besides it looks like its clunking out on the first line. I try to keep things as platform agnostic as possible, and linux really likes it when that’s there. :slight_smile:

sqrt[-1] and Humus: Both of your suggestions sound reasonable, I will let you both know when I finally get a chance to try them.

I’m trying to get the OpenGL lighting model (the entire thing from textures) to run on a per-pixel basis. I’m pretty much copying my shader’s source from the Orange book.

Thanks for everyone’s help!

to my lines worked. Thanks again everyone!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.