I have been told that this is kind of a common problem with transparent textures, but didn't get any further information on how to solve it.

In my code, I'm trying to render this texture (a square with rounded corners, where rounded corners have some alpha)

enter image description here

What I get instead is this


Notice those greyish places on the corners of the textures - where rounded corners are supposed to be.

What could be causing this? I have a pure-white texture, so I don't expect a single pixel to get any darker than the background. All pixels should have at least the color of background, but as you can see, there is something darker.

Zoomed even more: enter image description here

Any help would be highly appreciated.

  • 1
    \$\begingroup\$ Did you tried other textures with alpha channel? Maybe there is really a border \$\endgroup\$ Jan 6, 2016 at 21:42
  • \$\begingroup\$ Yes, and the thing is even worse with some other shapes. prntscr.com/9n21fb \$\endgroup\$
    – user35443
    Jan 7, 2016 at 6:01

1 Answer 1


It looks like the color values are premultiplied with the alpha but are rendered with the non premultiplied blending factors.

This makes the color of any texels with alpha < 1 darker than they should be.

For premultiplied alpha textures blending factors should be:


You can test this by making your white rounded rectangle texture 50% opaque (the actual texture, not the vertex colors) and see if it makes a white/light background darker.

The usual factors (glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);) will cause this darkening on premultiplied textures. A similar issue happens with linear interpolation of color when textures are not premultiplied.

  • \$\begingroup\$ I tried what you said and yes, they are darker. prntscr.com/9n24iv However, I didn't quite understand where the problem actually lies. What could I do to make it right? \$\endgroup\$
    – user35443
    Jan 7, 2016 at 6:19
  • \$\begingroup\$ try calling glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); before drawing your quads. It's the proper blending mode for premultiplied alpha textures. You can search the web for "premultiplied alpha" to find a large number of blog post and tutorials on the topic. Everyone needs a few different explanations on this topic before it clicks even if the solution is simple. \$\endgroup\$ Jan 7, 2016 at 13:24

You must log in to answer this question.

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