Blending Problem

This is a discussion on Blending Problem within the Game Programming forums, part of the General Programming Boards category; I'm having a little trouble with blending in my Asteroids game. The asteroids are png files with transparency, this way ...

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

    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.
    Code:
    glEnable( GL_BLEND );
        glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    Here's what I'm talking about
    http://i14.photobucket.com/albums/a3...ions-Aster.png

    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
    Posts
    9,596
    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.

    Sample:
    Last edited by VirtualAce; 03-12-2011 at 10: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, 10: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21