顶点着色器是正确的,但无法在我的硬件上运行?

发布于 2024-11-14 21:30:42 字数 941 浏览 3 评论 0原文

我不明白这个着色器有什么问题。它是正确的、编译和链接的,但根本无法在我的硬件上运行(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文