When trying to compile GLSL shaders in C/C++ using GLFW/GLEW I get the following error:
0(12) : error C5052: gl_Position is not accessible in this profile
I followed a tutorial from learnopengl.com. The code runs and displays a empty while square with the above error message being printed to the command line. Any ideas what is happening and how I might fix it?
The fragment shader is:
#version 410
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aColor;
layout (location = 2) in vec2 aTexCoord;
out vec3 ourColor;
out vec2 TexCoord;
void main()
{
gl_Position = vec4(aPos, 1.0);
ourColor = aColor;
TexCoord = aTexCoord;
}
And the vertex shader is:
#version 410
out vec4 FragColor;
in vec3 ourColor;
in vec2 TexCoord;
uniform sampler2D ourTexture;
void main()
{
FragColor = texture(ourTexture, TexCoord);
}
If you would like to see the rest of the code please refer to the tutorial link above.
gl_Position
in a fragment shader). – Lauretta