Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several monochromatic sprites and I render them with alpha = 0.25 (all of them the same value). I want to "paint" with them, so when they overlap, the alpha won't be added. I am not sure if I can express myself properly in English - here is an image of what I want to achieve (background visibility is important).

Required alpha blending

Is this achievable in OpenGL ES 2.0? I was trying to figure out the different modes of alpha blending, but without success. Also if anyone can tell me, how is this called, I can continue my search.

If this is not possible, I was thinking maybe I can somehow render the monochromatic sprites (alpha = 1) to a texture and only then render this texture on screen. How can this be done in AndEngine?

share|improve this question
up vote 3 down vote accepted

You can not achieve it in OpenGL, neither in DirectX, by changing blending equation.

To do that, you should render 4 circles into a separate texture with alpha = 1, then render that texture over former background with alpha = 0.25.

share|improve this answer

Two approaches come to mind.

  1. As you say, render your sprites to a texture and then render that texture on top of the background. Note that you don't need to specifically use alpha 1.0: you could also use an alpha test (implemented in your fragment shader) and no blending, which would allow you to have sprites with different transparency levels (which overwrite each other).

  2. Use a depth buffer and enable depth testing. Since all your sprites are probably already drawn at the same depth, this will make sure that overlaps are hidden. (In general 3D, this is a recipe for terrible z-fighting, but since your perspective is orthogonal there are no numerical issues to worry about.)

share|improve this answer

Your Answer


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.