Apoptose
06-14-2012, 08:51 AM
Hi,
my Problem is, that glShaderSource() cuts the Vertex Shader code, so glCompileShader() will fail and report the following error:
0(11) : error C0000: syntax error, unexpected $undefined, expecting "::" at token "<undefined>"
the Vertex Shader code is:
#version 400
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexTexCoord;
out vec3 TexCoord;
void main()
{
TexCoord = VertexTexCoord;
gl_Position = vec4(VertexPosition, 1.0);
}
glGetShaderSource() returns:
#version 400
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexTexCoord;
out vec3 TexCoord;
void main()
{
TexCoord = VertexTexCoord;
gl_Position = vec4(VertexPosit�
so glShaderSource() seems to screw up with copying the String. I use the following function to load the shader:
const char* loadShaderAsString(const char* file){
std::ifstream shader_file(file, std::ifstream::in);
std::string str((std::istreambuf_iterator<char>(shader_file)), std::istreambuf_iterator<char>());
return str.c_str();
}
printf() prints the String correctly.
I've tested this with an NVIDIA GTS 450. Operating system is Ubuntu 12.04.
I attached the Eclipse(Indigo) CDT Project.
Hopefully this is the correct forum since this *might* be a bug.
Thanks for any help,
Apoptose
my Problem is, that glShaderSource() cuts the Vertex Shader code, so glCompileShader() will fail and report the following error:
0(11) : error C0000: syntax error, unexpected $undefined, expecting "::" at token "<undefined>"
the Vertex Shader code is:
#version 400
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexTexCoord;
out vec3 TexCoord;
void main()
{
TexCoord = VertexTexCoord;
gl_Position = vec4(VertexPosition, 1.0);
}
glGetShaderSource() returns:
#version 400
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec3 VertexTexCoord;
out vec3 TexCoord;
void main()
{
TexCoord = VertexTexCoord;
gl_Position = vec4(VertexPosit�
so glShaderSource() seems to screw up with copying the String. I use the following function to load the shader:
const char* loadShaderAsString(const char* file){
std::ifstream shader_file(file, std::ifstream::in);
std::string str((std::istreambuf_iterator<char>(shader_file)), std::istreambuf_iterator<char>());
return str.c_str();
}
printf() prints the String correctly.
I've tested this with an NVIDIA GTS 450. Operating system is Ubuntu 12.04.
I attached the Eclipse(Indigo) CDT Project.
Hopefully this is the correct forum since this *might* be a bug.
Thanks for any help,
Apoptose