hello.
I don’t know if it was raported here because many previous post looks like empty.
I’ve noticed that
uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights]; doesn’t work in fragment shader on my ATI 9700PRO with Catalyst 4.12.
There is nothing about it in GLSL specs but I haven’t check the gl 1.4 and 2.0 specs right now.
Can You tell me more about issues of this type? I would like to know them before I start to code. Thanks.
I don’t try this, but I think that gl_LightSource isn’t available in fragment shader because vec4 position; member of structure and many others. They must be interpolated across triangle and this isn’t supported. But you can try this:
If you want the position of light you must interpolate is with varying variable. And if you want only a color of light or something like this, you can send it from OpenGL to fragment shader via uniform variable.
hmm I think that position/direction of light doesn’t need to be interpolated and it can be easly send to shader as uniform. I think that You meant Light Vector which must be interpolated.
There’s many solution for this problem, but I wanted to know if there’re more issues like this in GLSL.
Thanks for reply!
PS
I heard that in current version of GLSL there is no possibility to write skinning because of bad temporary register assigning? Is this correct? What shall I do then write an ARB asm version and wait for corrections or is there another solution?
I tried using glLightfv before and after glUseProgramObjectARB
I’ve also validated my program.
Hmm I noticed that when I use glValidateProgramARB
on every frame then the fps counter slowly decreases. (I’ve checked memory leaks and there are no leaks).
Can You write more about It?
If You need my code - which parts will be most dubious?
Hello.
Humus: I’ve noticed some things here, with a 9600XT, when using built-in uniform states from in the fragment shader.
If I try to do: gl_FragColor = gl_LightSource[0].ambient works fine.
If I try to do: gl_FragColor = gl_LightSource[0].diffuse it ever uses a black color, no matter what color I’ve inserted in the diffuse component.
Specular doesn’t work too (always black color).
All this things happens only in the fragment shader (if I fill a varying with the built in uniform in the VS and use it in the FS, the color is right)
Ffelagund: great(coz I haven’t got a bug)! I’ve noticed that most params from glPointSource doesn’t work in fragment shader. I’ve checked attenuation and position.
gl_FrontLightProduct works exactly like it should.
So I think that we’ll have to use uniforms until this is fixed.
And what about his validation problem? Have You checked it - I got slow fps decrease when I use it on every frame.
nik: hmm well, I’m sending light position in world coordinates - so maybe It is multiplied by modelview or even better - by projection matrix? As far as I’m concerned I was getting constant colors when calculating dot product and it was changing when I was rotating/moving the eye.
Thanks a lot I’ll check it out. So maybe it is my little bug then .
Originally posted by bonzaj: Hmm I noticed that when I use glValidateProgramARB
on every frame then the fps counter slowly decreases. (I’ve checked memory leaks and there are no leaks).
This is a known bug. As for the uniforms, I’ll investigate that tomorrow.
Humus: check gl_FrontLightProduct also!! I’ve written couple of posts ago that it works but It was working very randomly (working for couple of seconds and then black color, after another couple of seconds working and so on). When I’ve replaced it with my own uniforms It is working perfectly!.
I see that gl_FrontMaterial.shininess (and I think the rest of gl_FrontMaterial) is working 100% time.
I’ve checked glPointSource[].position (that matrix issue) with no good results .