Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

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

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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