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 5 of 5

Thread: Shader - problem with ATI cards (colors + transparency)

  1. #1
    Intern Newbie
    Join Date
    Oct 2010
    Posts
    47

    Shader - problem with ATI cards (colors + transparency)

    Hello,

    I use a simple phong shader to compute lighting.
    It works fine on nvidia cards.

    But with all ATI cards I always obtain funny colors and sometimes the good transparency (alpha).

    The code is like this :
    Code :
    for all layers in my data
             init opengl + light
             use shader
             render display lists
             unload shader
             disable light
    endfor
    The code uses glColor and glColorMaterial to set the colors.

    In the fragment shader :
    - If I only assign gl_Color to the gl_FragColor I have no light but the good colors.
    - If I do anything with the light the results are bad :

    For example with only ambient :
    gl_FragColor = gl_LightSource[0].ambient * gl_FrontMaterial.ambient;
    I obtain a bad color and no transparency
    With diffuse only :
    gl_FragColor = gl_FrontLightProduct[0].diffuse * max(dot(N,L), 0.0);
    I have bad colors but transparency.

    And some layers in my data seem to have no light (black color).

    Do you know what can produce such results on ATI cards ?

    Thanks

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,109
    Can only suggest the usual - make sure you have the latest driver also stop using glColorMaterial etc as this is old OpenGL so maybe it is not as well tested on newer drivers

  3. #3
    Intern Newbie
    Join Date
    Oct 2010
    Posts
    47
    I am adding code on a lot of existing code ; that's why I have to use old OpenGL. But I am trying to add some new OpenGL...

    I read that nvidia is more permissive than ati. So I think there are errors in our code but it's difficult to know where to search.

    Thanks for your answer.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,109
    I have often found things with slight errors often work on nVidia but break on ATI. I can't complain since it usually my error.

  5. #5
    Intern Newbie
    Join Date
    Oct 2010
    Posts
    47
    Hello,

    In fact the color is not set in the display lists in the existing code.
    So I followed your advice and I replaced glColor with glMaterial.
    And now it works on ATI too.

    So I have not to search errors in our code... (The problem with glColorMaterial was on old cards too (X1300/1550 and x1950) and these drivers may work with glColorMaterial...).

    Thanks for your help.

Posting Permissions

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