Had a problem access gl_LightSource on intel X3100

Since intel finally release latest driver for X3100 that support OpenGL 2.0 and DirectX 10.1,so I try to run my simple GLSL application on it.

the problem is I cant access gl_LightSource in shader.

trying to call some thing like gl_LightSource[0].diffuse will cause program to render some garbage or some time just render black geometry.

even GLSL demo I loaded from lighthouse 3d website (Toon shade ARB/Toon shade GL2) wont work (the teapot turn totally black).

all the shader are compile & link successfully and sending/using
custom uniform variable cause no problem.

anybody who use x3100 chipset has the same problem ?

Sorry for my bad english.

Imho, nothing new from the Intel camp.
I’d try to find what functionality exactly the x3100 really supports. Probably you need to ignore all predefined uniforms, and set ones yourself. Find a tutorial/demo that works on x3100, and stick with the functionality subset used there.

are the value in gl_LightSource[x].position using in shader the same as position I send via glLightfv() or it has been tranform ?

since I may had to create uniform variable to store lighting variable myself.

Try sending your own light stuff to the shader. I think those light builtins are deprecated anyways…

hi, while sending light position as uniform Yourself, You have to make some thingz to have it working properly. It depends on the light source type.

For directional light source it’s simple cause position means direction also:

uniform vec3 position;
vec3 L = normalize(position);

For light sources that have position in space (like point light) You have to do like this:

vec4 V4 = gl_ModelViewMatrix * gl_Vertex;
vec3 Vpos = V4.xyz / V4.w;

L = position - Vpos;
L = normalize(L);

because You have to get vector from vertex to light for further computations ;).

They have been transformed by the modelview matrix at the time that you called glLightfv().
I recommend that you call glLoadIdentity before glLightfv or better yet, just use your own uniforms.

how about a combo? I use something like this to deal with both types:

vec3 lightDir = normalize(lightPos.xyz - fragWorldPos.xyz * lightPos.w);

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.