Topic Options
Rate This Topic
#246267 - 09/23/08 05:50 AM Had a problem access gl_LightSource on intel X3100
somboon Offline
Newbie

Registered: 09/11/06
Posts: 40
Loc: thailand
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.


Edited by somboon (09/23/08 05:54 AM)

Top
#246270 - 09/23/08 06:16 AM Re: Had a problem access gl_LightSource on intel X3100 [Re: somboon]
Ilian Dinev Offline
Frequent Contributor
****

Registered: 01/26/08
Posts: 822
Loc: Bulgaria
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.

Top
#246273 - 09/23/08 07:07 AM Re: Had a problem access gl_LightSource on intel X3100 [Re: Ilian Dinev]
somboon Offline
Newbie

Registered: 09/11/06
Posts: 40
Loc: thailand
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.

Top
#246284 - 09/23/08 01:04 PM Re: Had a problem access gl_LightSource on intel X3100 [Re: somboon]
Brolingstanz Offline
OpenGL Pro
****

Registered: 09/16/04
Posts: 1383
Loc: Prombaatu
Try sending your own light stuff to the shader. I think those light builtins are deprecated anyways...

Top
#246497 - 09/29/08 05:09 AM Re: Had a problem access gl_LightSource on intel X3100 [Re: somboon]
Warzywo Offline
Newbie

Registered: 11/04/07
Posts: 17
Loc: Poland
 Originally Posted By: somboon
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.


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:

 Code:
uniform vec3 position;
...
vec3 L = normalize(position);


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

 Code:
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 ;).

Top
#246546 - 09/29/08 03:46 PM Re: Had a problem access gl_LightSource on intel X3100 [Re: somboon]
V-man Offline

OpenGL Guru
*****

Registered: 02/21/00
Posts: 3440
Loc: Montreal, Canada
 Originally Posted By: somboon
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.


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.

Top
#246549 - 09/29/08 05:45 PM Re: Had a problem access gl_LightSource on intel X3100 [Re: Warzywo]
Brolingstanz Offline
OpenGL Pro
****

Registered: 09/16/04
Posts: 1383
Loc: Prombaatu
how about a combo? I use something like this to deal with both types:
 Code:
vec3 lightDir = normalize(lightPos.xyz - fragWorldPos.xyz * lightPos.w);


Edited by modus (09/29/08 05:52 PM)

Top


Moderator:  Tom Nuydens, Zengar 
Who's Online
4 registered (Nonozor, Irena, Maire Nicolas, aronsatie), 54 Guests and 95 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
Nonozor, Maire Nicolas, minakshee, Koter, pixelwrangler
24934 Registered Users
Top Posters (30 Days)
Alfonse Reinheart 152
ZbuffeR 92
Dark Photon 73
marshats 47
Brolingstanz 44
Ilian Dinev 41
Iulian B 38
Stephen A 37
Kip Warner 28
devdept 26
igorgiv 23
skynet 23
Pierre 23
DarkShadow44 23
Yann LE PETITCORPS 22
scratt 21
Abdallah DIB 21
Aleksandar 20
mikeynovemberoscar 19
Pierre Boudier 19
Forum Stats
24934 Members
12 Forums
52392 Topics
271540 Posts

Max Online: 482 @ 08/11/08 06:19 PM