2010-03-06 184 views
2

在編譯錯誤發生時查詢信息日誌後我得到了這個。我一直無法找到一個能夠告訴我錯誤代碼甚至意味着什麼的資源!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

回答

0

修正了它。使用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