OpenGL Textures/Transparency

This is a discussion on OpenGL Textures/Transparency within the Game Programming forums, part of the General Programming Boards category; I've been looking through MSDN and various sites I've found on google that have information on texture mapping in OpenGL, ...

  1. #1
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972

    OpenGL Textures/Transparency

    I've been looking through MSDN and various sites I've found on google that have information on texture mapping in OpenGL, but I haven't found any ways (that I can get to work) that don't use an alpha channel.

    What I want to do is be able to specify a color that is completely transparent and the rest of the image should be completely opaque. Using the method from Nehe's tutorials (glBlendFunc), the image blends with any textures that are behind it, which is not what I want.

    I've also come across a site that said you could use glTexEnv with GL_BLEND as the last parameter to achieve this, but it didn't describe in detail how that would work. (I tried a few things that produced strange results.)

    I could probably figure out a way to loop through all the data in the bitmap and add alpha where the transparent color is present, or I could probably choose a different type of image file, but I thought maybe someone here had an easier way before I go to all that trouble.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    to do that, you could create your own bitmap loader that recognizes a color as the "color key." Whatever the color you choose to be the key will not be drawn. The rest would just have full alpha.

    I'm not sure if OpenGL can do this for you, it's been quite some time since I used textures with it. However, it would surprise me if it weren't in there somewhere.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

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