View Full Version : Shader Compile Error
06-03-2005, 01:16 PM
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?
06-03-2005, 01:23 PM
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)
06-03-2005, 04:05 PM
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)
06-04-2005, 10:35 AM
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
06-04-2005, 11:58 AM
It sounds like you're reading the file line by line, then adding the lines together, but forgetting the '\n', 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. :)
06-04-2005, 05:19 PM
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. :)
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!
06-05-2005, 12:38 PM
Adding \n to my lines worked. Thanks again everyone!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.