顶点着色器是正确的,但无法在我的硬件上运行?
我不明白这个着色器有什么问题。它是正确的、编译和链接的,但根本无法在我的硬件上运行(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();
}
有没有人觉得这里有什么不对劲的地方?感谢您的任何建议/意见。
I can't figure out what's wrong with this shader. It's correct, compiles, and links, but simply won't run on my hardware (MacBook pro w/NVidia GeForce 9400, nothing special). It seems totally GLSL 1.2 compliant
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();
}
Does anything in here seem amiss to anyone? Thanks for any suggestions/advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论