PDA

View Full Version : Spotlights and vertex programs



Roman Grigoriev
03-23-2003, 10:44 PM
Hi guys!
I found tons of point light per-pixel attenuation samples that use vertex programs but can find any examples that simulate spotlights in vertex programs. I'm not expirienced in opengl math so maybe someone did it. If someone knows where can I find code please answer me
Thanx in advance
Bye

fritzlang
03-24-2003, 01:24 AM
Dot product the vertex pos and your spotlight matrix.

DP4 outTexture.x, mtx[0], inPosition;
DP4 outTexture.y, mtx[1], inPosition;
DP4 outTexture.z, mtx[2], inPosition;
DP4 outTexture.w, mtx[3], inPosition;

Goodluck.

Roman Grigoriev
03-24-2003, 01:47 AM
Could you please give me source code
and shader?