I am not presently rendering front or back faces. I am only rendering the sihllouette edges. I calculate the edges (relative to the light source) and project them away from the light source, creating a quad out of each edge.
The rendering routine I am using is from Nehe tutorial 27:
glclear GL_STENCIL_BUFFER_BIT
glDisable GL_LIGHTING' Turn Off Lighting
glDepthMask GL_FALSE' Turn Off Writing To The Depth-Buffer
glEnable GL_STENCIL_TEST' Turn On Stencil Buffer Testing
glColorMask GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE' Don't Draw Into The Colour Buffer
glStencilFunc GL_ALWAYS,1,$ff
'First Pass. Increase Stencil Value In The Shadow
glFrontFace GL_CCW
glStencilOp GL_KEEP,GL_KEEP,GL_INCR
lightlink.shadowvolume.draw()
'Second Pass. Decrease Stencil Value In The Shadow
glFrontFace(GL_CW)
glStencilOp(GL_KEEP,GL_KEEP,GL_DECR)
lightlink.shadowvolume.draw()
glColorMask GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE' Enable Rendering To Colour Buffer For All Components
glEnable GL_BLEND
glBlendFunc GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA
a#=lightlink.distancefade*lightlink.intensity*0.5
glColor4f 0.0,0.0,0.0,a
glStencilFunc GL_NOTEQUAL,0,$ff
'glStencilFunc GL_EQUAL,1,$ff
glStencilOp GL_KEEP,GL_KEEP,GL_KEEP
gldisable GL_CULL_FACE
glBegin GL_QUADS
tformpoint 100,100,100,camera,entity
glvertex3f tformedx(),tformedy(),tformedz()
tformpoint -100,100,100,camera,entity
glvertex3f tformedx(),tformedy(),tformedz()
tformpoint -100,-100,100,camera,entity
glvertex3f tformedx(),tformedy(),tformedz()
tformpoint 100,-100,100,camera,entity
glvertex3f tformedx(),tformedy(),tformedz()
glend
glenable GL_CULL_FACE
gldisable GL_BLEND