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);
glCompileShader(this->vertexShaderID);
glCompileShader(this->fragmentShaderID);
this->programID = glCreateProgram();
glAttachShader(this->programID, this->vertexShaderID);
glAttachShader(this->programID, this->fragmentShaderID);
glLinkProgram(this->programID);