Basically I've edited my shader to look like this:
GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path)
{
try
{
checkForGLError();
cerr<<"Before shaders...\n";
// Create the shaders
GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
cerr<<"Shaders allocated.\n";
checkForGLError();
// Read the Vertex Shader code from the file
std::string VertexShaderCode;
std::ifstream VertexShaderStream(vertex_file_path, std::ios::in);
if(VertexShaderStream.is_open())
{
std::string Line = "";
while(getline(VertexShaderStream, Line))
VertexShaderCode += "\n" + Line;
VertexShaderStream.close();
}
cerr<<"Vertex shader length: "<<VertexShaderCode.length()<<"\n";
checkForGLError();
// Read the Fragment Shader code from the file
std::string FragmentShaderCode;
std::ifstream FragmentShaderStream(fragment_file_path, std::ios::in);
if(FragmentShaderStream.is_open()){
std::string Line = "";
while(getline(FragmentShaderStream, Line))
FragmentShaderCode += "\n" + Line;
FragmentShaderStream.close();
}
cerr<<"Fragment shader length: "<<FragmentShaderCode.length()<<"\n";
checkForGLError();
GLint Result = GL_FALSE;
int InfoLogLength;
// Compile Vertex Shader
log("Compiling shader: "+string(vertex_file_path));
char const * VertexSourcePointer = VertexShaderCode.c_str();
cerr<<"v1\n";
glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
checkForGLError();
cerr<<"v2\n";
glCompileShader(VertexShaderID);
cerr<<"v3\n";
checkForGLError();
// Check Vertex Shader
glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
std::vector<char> VertexShaderErrorMessage(InfoLogLength);
glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
log(&VertexShaderErrorMessage[0]);
checkForGLError();
// Compile Fragment Shader
log("Compiling shader: "+string(fragment_file_path));
char const * FragmentSourcePointer = FragmentShaderCode.c_str();
glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
glCompileShader(FragmentShaderID);
checkForGLError();
// Check Fragment Shader
glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
std::vector<char> FragmentShaderErrorMessage(InfoLogLength);
glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
log(&FragmentShaderErrorMessage[0]);
checkForGLError();
// Link the program
log("Linking program.");
GLuint ProgramID = glCreateProgram();
glAttachShader(ProgramID, VertexShaderID);
glAttachShader(ProgramID, FragmentShaderID);
glLinkProgram(ProgramID);
checkForGLError();
// Check the program
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
std::vector<char> ProgramErrorMessage( max(InfoLogLength, int(1)) );
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
log(&ProgramErrorMessage[0]);
checkForGLError();
glDeleteShader(VertexShaderID);
glDeleteShader(FragmentShaderID);
return ProgramID;
}
catch(int exc)
{
log("Making shader threw exception: "+ istr(exc));
}
}
Where checkForGLError is defined as:
void checkForGLError()
{
GLenum err;
while ((err = glGetError()) != GL_NO_ERROR)
{
log("OpenGL error: " + err);
cerr << "OpenGL error: " << err << endl;
}
}
Basically if an exception is thrown I'll know.I know the lengths of the strings before the code attempts to compile them.
I know which step in compiling it gets to (v1,v2,v3)
And if there are any glErrors thrown I'll hopefully see them.
If at your convince you or someone else could redownload the program, run it, and post stderr.txt (it'll have more information than logfile.txt) that'd be great.