Thread: Blending Problem

  1. #1
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Lurking about

    Blending Problem

    I'm having a little trouble with blending in my Asteroids game. The asteroids are png files with transparency, this way when they overlap you don't see the black box around the asteroids because it's transparent.

    Here's how I'm using blending.
    glEnable( GL_BLEND );
        glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    Here's what I'm talking about

    So basically I want the pixels around the asteroid to be transparent, but the actual asteroid pixels to not show through.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    In Direct3D you do this:

    1. Create color map.
    2. Create alpha map (White = opaque, black = transparent)
    3. Create dds file that merges alpha channel with color channels
    4. Set blend mode to: SRC_BLEND - SRC_ALPHA, DEST_BLEND - INV_SRC_ALPHA
    5. Render

    Perhaps you can 'port' that to GL.

    Last edited by VirtualAce; 03-12-2011 at 11:41 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Problem in mouse position
    By Arangol in forum Game Programming
    Replies: 6
    Last Post: 08-08-2006, 07:07 AM