GLSL错误:2001 - 这个错误代码是什么意思?

问题描述:

在编译错误发生时查询信息日志后我得到了这个。我一直无法找到一个能够告诉我错误代码甚至意味着什么的资源!GLSL错误:2001 - 这个错误代码是什么意思?

将Ubuntu 9.10与支持glsl 1.1的英特尔移动芯片组结合使用。梅萨司机。

顶点着色器:

#version 110 
in vec3 m2d_blendcolor; 

out vec3 color; 
// out vec2 texcoord0; 

void main(void) 
{ 
    gl_Position = ftransform(); 
    color = m2d_blendcolor; 
} 

片段着色器:

#version 110 

in vec3 color; 

void main(void) 
{ 
    gl_FragColor = vec4(color, 1.0); 
} 

当我初始化我Shader对象,我呼吁:

shader.bindAttrib(0, "m2d_vertex"); 
shader.bindAttrib(1, "m2d_texcoord0"); 
shader.bindAttrib(2, "m2d_blend_color"); 

这些呼叫

glBindAttribLocation(m_programID/*internal GLuint*/, index, attribName.c_str()); 

是否我过早地绑定了顶点属性?当着色器被绑定时他们必须被绑定吗?

+0

什么一行生成错误代码? – 2010-03-07 00:12:35

+0

我不知道哈哈。 MESA不会告诉我!它在日志中说的是“Error:2001”。期。 – Orm 2010-03-07 00:17:08

+0

等等......您的着色器没有m2d_texcoord0和m2d_vertex ...或者m2d_blend_color(检查下划线)。我会尝试修复那些第一。最后...着色器代码看起来不像GLSL ... – 2010-03-07 00:18:01

修正了它。使用glsl 1.1时,输入和输出限定符无效。

Khronos OpenGL wiki - Type Qualifier (GLSL)

The following qualifiers are deprecated as of GLSL 1.30 (OpenGL 3.0) and removed from GLSL 1.40 and above.

The attribute qualifier is effectively equivalent to an input qualifier in vertex shaders. It cannot be used in any other shader stage. It cannot be used in interface blocks.

The varying qualifier is equivalent to the input of a fragment shader or the output of a vertex shader. It cannot be used in any other shader stages. It cannot be used in interface blocks.

+4

你能接受你自己的答案吗? – Bahbar 2010-03-09 17:14:15