Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: GLSL and nVidia issue

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    3

    GLSL and nVidia issue

    Well, the title says almost all.

    I'm using shader to simulate bumpmapping and lightmap, it worked ok in my ATI card, but when I tried to run it in nVidia cards, it crashed. I even tried in a IGFX and it worked.
    first I thought it was an application error, but then when I "propousitadely" make a mistake which will make the shader not compile (consequently, not used), and them, no crash.

    Now the tricky part:
    There is other models which shader works. That model already uses the bumpmap, but no lightmap. and it worked. So I thought it was a lightmap issue, so I deactivated it and tried again, and then I still got the problem! And it only happens in nVidia.

    Vertex Shader:
    Code :
    uniform sampler2D mainTexture;
    uniform sampler2D normalTexture;
    uniform sampler2D lightTexture;
    varying vec3 normal;
     
    void main()
    {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_TexCoord[1] = gl_MultiTexCoord2;
     
     
    normal = normalize(gl_NormalMatrix * gl_Normal);
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
     
    }


    *ps: before I was using gl_TexCoord[2] = gl_MultiTexCoord2; but some one told me to never do that. I don't understand why, in any case, I got the same error.

    frag shader:
    Code :
    uniform sampler2D mainTexture;
    uniform sampler2D normalTexture;
    uniform sampler2D lightTexture;
    varying vec3 normal;
     
    void main()
    {
    vec3 normalMap = normalize(texture2D(normalTexture, gl_TexCoord[0].st).rgb * 2.0 - 1.0);
    vec4 base = vec4(texture2D(mainTexture, gl_TexCoord[0].st).rgb,1.0);
    vec4 lightMap = vec4(texture2D(lightTexture, gl_TexCoord[1].st).rgb,1.0);
    float BaseNormal = max(dot(reflect(-vec3(0.5,1.0,0.5),normalMap),normalMap),0.0);
     
    vec3 finalColor = base.xyz*lightMap.xyz;
    finalColor *= BaseNormal;
     
     
    gl_FragColor = vec4(finalColor,1.0);
    }

    well, that's it, any ideia or tests for me to do?

    Regards,

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    What GLSL compiler errors do you get? Any GL errors?

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    3
    no errors, the application crash in nVidia cards, the same shader runs nice on ATI and IGFX cards...

  4. #4
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    3
    Any Ideias?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •