problem with multiple lights

Hello! I have implemented a lighting pass and a shadow pass(shadow maps)…and i can combine them fine (using DST_COLOR,ZERO) but ive been tinkering and I cant seem to get them to combine in a way that would allow multiple lights! Ive tried using a combination of the alpha buffer and stencil buffer but i cant get the settings right. Any suggestions?

(btw…the lighting pass has no room left in it, hence the multi pass method).

For each light source:

  • Disable RGB writes; render shadowing to destination alpha without blending.
  • Enable RGB writes; render lighting with (GL_DST_ALPHA, GL_ONE) blending.

Also, for everything except the very first pass (the shadow pass of the first light, or possibly an ambient pass), use a GL_EQUAL depthfunc.

– Tom

dude, i love u!!
…hehe. I think I should sleep more, then I wont have to ask such stupid questions at this time of night…cheers!