View Full Version : Shader - problem with ATI cards (colors + transparency)

11-29-2012, 05:12 AM

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 :

for all layers in my data
init opengl + light
use shader
render display lists
unload shader
disable light
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 ?


11-29-2012, 09:32 PM
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

11-30-2012, 01:43 AM
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.

11-30-2012, 04:41 PM
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.

12-04-2012, 08:18 AM

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.