Vexator

08-11-2006, 03:21 AM

so far i'm still using opengl's built-in uniforms for most of my lighting calculations, but i'd like to replace them by my own uniforms. this works well in most cases, but i still have some problems..

i realized that if i want to emulate gl_LightSource[n].position e.g., that i have to multiply my original vector by the inverse of the current modelview matrix and then pass this to the shader.

but what do i have to do to emulate gl_LightSource[n].spotDirection? i tried to do it the same way, but it results in no spotlight cone at all. in addition, gl_LightSource[n].spotCosCutoff does not seem to be equal to cos(gl_LightSource[n].spotCutoff)..

is there a document that decribes how these built-in uniforms are computed? it's not in the glsl specs :(

i realized that if i want to emulate gl_LightSource[n].position e.g., that i have to multiply my original vector by the inverse of the current modelview matrix and then pass this to the shader.

but what do i have to do to emulate gl_LightSource[n].spotDirection? i tried to do it the same way, but it results in no spotlight cone at all. in addition, gl_LightSource[n].spotCosCutoff does not seem to be equal to cos(gl_LightSource[n].spotCutoff)..

is there a document that decribes how these built-in uniforms are computed? it's not in the glsl specs :(