Results 1 to 3 of 3

Thread: Blending texture background bug.

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    28

    Blending texture background bug.

    Hi

    I'm drawing bitmaps with transparent background.When the objects don't overlap each other then all is good, but when they overlap then there is some disturbance. I'm using

    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    Is it right? My alpha value is from PNG alpha chanel.

    Thanks.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,649

    Re: Blending texture background bug.

    Are you drawing the alpha objects back-to-front?

    Generally speaking, if you want good multi-layer compositing (e.g. for alpha texture impostors), you're going to want to use pre-multiplied alpha. It's associative. That is (ONE, ONE_MINUS_SRC_ALPHA) blend function, with a texture that has already had the alpha pre-multiplied:

    http://home.comcast.net/~tom_forsyth/blog.wiki.html#[[Premultiplied%20alpha]]

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2010
    Posts
    28

    Re: Blending texture background bug.

    Thanks, solved

    I also forgot to add glDepthMask(GL_FALSE);

Similar Threads

  1. Avoid Blending with Background when Blending Quads
    By Aboleoneo in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-05-2017, 05:54 PM
  2. texture as a background
    By kcsin in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-08-2011, 01:50 PM
  3. How to prevent blending with background?
    By dorpez in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-01-2011, 03:46 AM
  4. Setting texture as background...
    By guzba in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-19-2003, 05:44 PM
  5. Blending over white background
    By Sektor in forum OpenGL: Advanced Coding
    Replies: 21
    Last Post: 12-10-2002, 05:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean