ERROR: 0:1: '' : Version number not supported by GL2
ERROR: 0:1: '' : Version number not supported by GL2
我正在尝试制作着色器,但出现此错误:
ERROR: 0:1: ' ' : Version number not supported by GL2
ERROR: 0:3: 'layout' : syntax error parse error
请帮忙!
这是我的顶点着色器代码:
#version 330
layout(location = 0) in vec4 position;
void main()
{
gl_Position = position;
}
这是我的片段着色器代码:
#version 330
layout(location = 0) out vec4 color;
void main()
{
color = vec4(1.0, 0.0, 0.0, 1.0);
}
我试过把版本调低,但是没用。
由于您的显卡驱动程序和显卡仅支持 OpenGL 2.0,您无法使用 3.30 版的 GLSL 着色器。您需要使用对应 OpenGL 2.0 的 GLSL 1.10。
参见 OpenGL Shading Language 1.10 Specification and OpenGL specification - Khronos OpenGL registry
合适的着色器是:
顶点着色器
#version 110
attribute vec4 position;
void main()
{
gl_Position = position;
}
片段着色器
#version 110
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
我正在尝试制作着色器,但出现此错误:
ERROR: 0:1: ' ' : Version number not supported by GL2
ERROR: 0:3: 'layout' : syntax error parse error
请帮忙! 这是我的顶点着色器代码:
#version 330
layout(location = 0) in vec4 position;
void main()
{
gl_Position = position;
}
这是我的片段着色器代码:
#version 330
layout(location = 0) out vec4 color;
void main()
{
color = vec4(1.0, 0.0, 0.0, 1.0);
}
我试过把版本调低,但是没用。
由于您的显卡驱动程序和显卡仅支持 OpenGL 2.0,您无法使用 3.30 版的 GLSL 着色器。您需要使用对应 OpenGL 2.0 的 GLSL 1.10。
参见 OpenGL Shading Language 1.10 Specification and OpenGL specification - Khronos OpenGL registry
合适的着色器是:
顶点着色器
#version 110
attribute vec4 position;
void main()
{
gl_Position = position;
}
片段着色器
#version 110
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}