我无法弄清楚这个着色器有什么问题。它是正确的,可以编译和链接,但根本无法在我的硬件上运行(MacBook pro w/NVidia GeForce 9400,没什么特别的)。看起来完全符合 GLSL 1.2
vec4 position;
vec4 new_position;
varying vec3 lightV;
varying vec3 eyeV;
varying vec3 normalV;
varying vec4 ambient;
uniform float angle;
uniform int sens;
uniform vec3 lightSource;
void main(){
//ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient ;
ambient.x = 1.0;
ambient.y = 1.0;
ambient.z = 1.0;
ambient.w = 1.0;
//from vertex to light
//lightV = gl_LightSource[0].position.xyz;
lightV = lightSource;
// vertex position in eye space
vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
//from vertex to eye
eyeV = - vVertex;
//normal
normalV = gl_NormalMatrix * vec3(0.0,1.0,0.0);
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
有人觉得这里有什么不对劲吗?感谢您的任何建议/建议。