I've finally got projection shadows working in OpenGL, however the only way I know to draw them is in solid black:
Does anyone know how to draw transparent shadows? I basically want to blend the existing color with the color black, but everything I've tried results in no shadow at all!
So what happens if you enable blending (with an appropriate glBlendFunc()) and use a > 0 alpha value?
As a start, and maybe push in the right direction, you'll need GL_BLEND on, and set glBlendFunc to something like "glBlendFunc(GL_ALPHA, GL_INVERSE_ALPHA)".
Hmm, I don't fully understand these blending functions... I fooled around until I found a combination that seems to work:
And the produced shadow (from the red cube):
{"name":"shadow_blended.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/7\/476bc4b4b0c009fee76011d5179a3662.png","w":788,"h":505,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/7\/476bc4b4b0c009fee76011d5179a3662"}
Yeah, that makes sense. ONE_MINUS_ALPHA is what I meant, but I'm used to Allegro 5 terms which call it INVERSE_ALPHA.
Yeah, that makes sense.
Even better! Cookies all around!
Normally, you'd want glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). That's the "standard" translucency blending function.
Oops, what gnolam said. I didn't catch that. :x