Shaders are not working

Hi everyone,
I am struggling with shaders right now. Below are my shaders.
#version 440 core
void main(void)
{
const vec4 vertices[3]=vec43;
gl_Position=vertices[gl_VertexID];
}

#version 440 core
out vec4 color;
void main(void)
{
color=vec4(1.0f,0.0f,0.0f,1.0f);
}

In render function, I used glDrawArrays(GL_TRIANGLES,0,3). They draw nothing. The problem is I dont know even where to start troubleshooting. They are compiled, linked and even validated successfully. All I get is a blank scene. Several issues, I believe, are also related to how I get the text into the shader source in the first place. So the code below is how load it.

ifstream input(****.txt);
string line, content;
while(!input.eof())
{
getline(input,line);
content. append(line+"
");
}
const GLchar *shader_source=content.c_str();
glShaderSource(vertex_shader,1,&shader_source,NULL);

Fragment shader is similar to the above one. If I print shader_source, I get whatever is in my text. So no problem there. If everything is fine here, then I need to examine the code elsewhere.

[QUOTE=ajith.mk;1280744]Hi everyone,
I am struggling with shaders right now. Below are my shaders.


const vec4 vertices[3]=vec4[3](vec4(10,-10,15,1.0),vec4(-10,-10,10,1.0),vec4(10,10,10,1.0));
gl_Position=vertices[gl_VertexID];

[/QUOTE]
All of those vertices are beyond the far plane, so the triangle will be discarded. Bear in mind that gl_Position is in clip space.

Also, please use

 tags around code.

[QUOTE=ajith.mk;1280744]Hi everyone,
Several issues, I believe,  are also related to how I get the text into the shader source in the first place.
[/QUOTE]
For simple test cases, using a string literal is an option. The main thing is to remember the "
" at the end of any preprocessor directive (it doesn't matter if the rest of the code is all on one line).

Otherwise, the simplest way to read a file into a string in C++ is probably

std::string readfile(std::istream& s)
{
std::ostringstream ss;
ss << s.rdbuf();
return ss.str();
}

:smiley: Got it. I concentrated too much on syntax errors, string loading etc.