What I am looking for is the following: I have a circle on a square image, alpha is 0 at the corners

enter image description here

and also a square shadow, alpha is 0 everywhere else

enter image description here

I would like to have as final result a blending of these two renders, plus the shadow not being rendered outside the circle

How could I achieve that?

  • 1
    \$\begingroup\$ "blending of these two renders" What does that mean? What kind of "blending" are you looking for? \$\endgroup\$ – Nicol Bolas Jun 22 '12 at 23:25
  • \$\begingroup\$ Could you provide a picture of what you're trying to achieve? \$\endgroup\$ – Laurent Couvidou Jun 25 '12 at 15:31
  • \$\begingroup\$ @NicolBolas I mean, the shadow over the circle, like this dl.dropbox.com/u/1401029/Result.png but "masking" the shadow over the circle \$\endgroup\$ – elect Jun 26 '12 at 9:04
  • \$\begingroup\$ @lorancou dl.dropbox.com/u/1401029/Result.png \$\endgroup\$ – elect Jun 26 '12 at 9:05
  • \$\begingroup\$ @elect I don't get it, is that what you want, or what you've achieved so far? \$\endgroup\$ – Laurent Couvidou Jun 26 '12 at 10:32

What you probably want is a stencil buffer. Render your circle with stencil write, and then change opengl state so that only the bits that have the stencil bits on should be updated, and then render your shadow thingy.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.