GLSL error: illegal non-ASCII character
GLSL error: illegal non-ASCII character
我正在为 openGl 编写顶点着色器。这是我的代码:
#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)
However, when I run my program, it seems like the error says there is some nonASCII character after my }, because in console prints:
如果传递的缓冲区长度与源字符串。
解决方案:如果您没有明确传递长度(即为长度参数传递 NULL),请确保源字符串正确地以零终止。否则请确保长度与源字符串缓冲区的长度正确匹配。
我正在为 openGl 编写顶点着色器。这是我的代码:
#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)
However, when I run my program, it seems like the error says there is some nonASCII character after my }, because in console prints:
如果传递的缓冲区长度与源字符串。
解决方案:如果您没有明确传递长度(即为长度参数传递 NULL),请确保源字符串正确地以零终止。否则请确保长度与源字符串缓冲区的长度正确匹配。