GLSL Error: parser finding no code

So, I’m learning GLSL and have a fragment shader with the extreme simple following code:

varying float diffuse_value;

void main()
	gl_FragColor = vec4(1.0, 0, 0, 1.0);

When I compile it, I get this error:

ERROR: 0:1: '/' : syntax error syntax error
ERROR: Parser found no code to compile in source strings.

I have no idea what to make of this. What does it mean? I know it’s finding the files correctly. By the way, the code I have to load the shader is as follows:

this->vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
	this->fragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
	const char *vertexShaderPathChar = vertexShaderPath.c_str();
	const char *fragmentShaderPathChar = fragmentShaderPath.c_str();
	glShaderSource(this->vertexShaderID, 1, &vertexShaderPathChar, NULL);
	glShaderSource(this->fragmentShaderID, 1, &fragmentShaderPathChar, NULL);
	this->programID = glCreateProgram();
	glAttachShader(this->programID, this->vertexShaderID);
	glAttachShader(this->programID, this->fragmentShaderID);


These names look suspiciously like filenames (“Path”), not shaders. OpenGL does not read files; that’s your job. You must give OpenGL what you load from that file.

Oh, i have to give them the text of the file? Well I’m an idiot. Okay, thanks.

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