0
我正在爲openGl寫一個頂點着色器。這是我的代碼:GLSL錯誤:非法非ASCII字符
#version 150
in vec4 vPosition;
in vec3 vNormal;
out vec3 fN;
out vec3 fE;
out vec3 fL;
uniform mat4 model_matrix;
uniform mat4 view_matrix;
uniform mat4 proj_matrix;
uniform vec4 lightPos;
void main()
{
vec3 pos = (view_matrix * model_matrix * vPosition).xyz;
vec3 lightPosInCam = (view_matrix * lightPos).xyz;
fN = normalize(view_matrix * model_matrix * vec4(vNormal,1.0)).xyz;
fE = normalize(vec3(0,0,0) - pos);
fL = normalize(lightPosInCam.xyz - pos);
gl_Position = proj_matrix*view_matrix*model_matrix*vPosition;
}
然而,當我運行我的程序,這似乎是錯誤說,有一些非ASCII字符我}
後,因爲在控制檯打印:
#version 150
in vec4 vPosition;
in vec3 vNormal;
out vec3 fN;
out vec3 fE;
out vec3 fL;
uniform mat4 model_matrix;
uniform mat4 view_matrix;
uniform mat4 proj_matrix;
uniform vec4 lightPos;
void main()
{
vec3 pos = (view_matrix * model_matrix * vPosition).xyz;
vec3 lightPosInCam = (view_matrix * lightPos).xyz;
fN = normalize(view_matrix * model_matrix * vec4(vNormal,1.0)).xyz;
fE = normalize(vec3(0,0,0) - pos);
fL = normalize(lightPosInCam.xyz - pos);
gl_Position = proj_matrix*view_matrix*model_matrix*vPosition;
}═════════════════════════
Printed Shader Read Status
vshader_hw5.glsl failed to compile:
ERROR: 0:26: '' : illegal non-ASCII character (0xcd)
ERROR: 0:26: '' : illegal non-ASCII character (0xcd)
ERROR: 0:26: '' : illegal non-ASCII character (0xcd)
ERROR: 0:26: '' : illegal non-ASCII character (0xcd)
ERROR: 0:26: '' : illegal non-ASCII character (0xcd)
ERROR: 0:26: '' : illegal non-ASCII character (0xcd)
對於我們所知道的你的着色器加載器是fubar。在[mcve]中編輯。 – genpfault
也許顯示您正在使用的代碼將着色器源提供給GL?似乎也許你的字符串沒有正確的空終止,或者你傳遞了不正確的長度。 – MuertoExcobito
一些看不見的unicode字符或控制代碼也是一個選項... – Spektre