This image describes the problem I'm having:

What you are seeing consists of two images:

  • Image A(with the alien-concept art thingy), depth value .98, the white parts on the image is where the alpha value is 0.0f

  • Image B(with the play game button thingy), depth value .99, one solid image without any transparency value.

Now, when I first set this up, I expected Image A to let the colours of Image B through where Image A is fully transparent. But it doesn't

Question 1 : Why doesn't it?

Question 2 : What can I do to fix it? Are there multiple ways to fix it?

Question 3 : Is this problem different for partial transparency? If so, how do I make it work with partial transparency as well?


  • \$\begingroup\$ Have you enabled blending and set up the proper blend function? In openGL this would be glEnable(GL_BLEND) and glBlendFunc() \$\endgroup\$
    – notlesh
    Feb 23, 2012 at 17:16
  • \$\begingroup\$ @stephelton yes. I think this has something to do with order-independent blending, but I'm not sure. It would be nice to hear from someone with more experience what the problem exactly is, and methods I can use to fix it \$\endgroup\$
    – xcrypt
    Feb 23, 2012 at 17:23

1 Answer 1


Are you rendering the images in the correct order? For blending to work, they need to render back-to-front, so Image B should be drawn first and then Image A should composite over it.

In general, the depth buffer does not work well when combined with blending / transparency; using the two together usually produces undesired results. See this answer to a similar question for a more in-depth explanation and rundown of the different approaches to solving it.

  • \$\begingroup\$ Ah right, but I just have to sort right? It's not like I need to disable the depth buffer? Because it would be silly to draw pixel (screenpos x,screenpos y) multiple times. I don't want to work with alpha testing because it doesn't allow partial transparency \$\endgroup\$
    – xcrypt
    Feb 23, 2012 at 17:44
  • 1
    \$\begingroup\$ You don't need to disable the depth buffer in this case, but the depth buffer doesn't help you at all, since if you draw back to front it never culls anything. When using blending you must draw some pixels multiple times, where the quads overlap. \$\endgroup\$ Feb 23, 2012 at 17:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .