It compiles without errors but it doesn't have any effect. I tried your way, there was no effect from the shader but the debugger did show correct output from shaderSource. I also tried to use it this way
bool CShader::loadVertexShader(int a_iType)
{
const GLchar* shaderSource = "#version 330\n"
"layout (location = 0) in vec3 inPosition;\n"
"layout (location = 1) in vec3 inColor;\n"
"smooth out vec3 theColor;\n"
"void main()\n"
"{\n"
"gl_Position = vec4(inPosition, 1.0);\n"
"theColor = inColor;\n"
"}\n";
uiShader = glCreateShader(a_iType);
glShaderSource(uiShader, 1, &shaderSource, NULL);
glCompileShader(uiShader);
ofstream outfile;
outfile.open ("log.txt", fstream::out | fstream::app);
outfile << shaderSource << endl;
outfile << endl;
outfile.close();
GLint compileStatus;
glGetShaderiv(uiShader, GL_COMPILE_STATUS, &compileStatus);
if (compileStatus == GL_FALSE)
{
GLint infoLogLength;
glGetShaderiv(uiShader, GL_INFO_LOG_LENGTH, &infoLogLength);
GLchar* infoLog = new GLchar[infoLogLength + 1];
glGetShaderInfoLog(uiShader, infoLogLength, NULL, infoLog);
ofstream outfile;
outfile.open ("log.txt");
outfile << infoLog << endl;
outfile.close();
delete[] infoLog;
}
return 1;
}
also no effect. I did this just in case I don't miss anything when doing this part
// Load shaders and create shader program
//shVertex.loadShader("data/shaders/color.vert", GL_VERTEX_SHADER);
shVertex.loadVertexShader(GL_VERTEX_SHADER);
shFragment.loadShader("data/shaders/color.frag", GL_FRAGMENT_SHADER);