Results 1 to 3 of 3

Thread: Transparency in a texture

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002

    Transparency in a texture

    ok i know i am dumb but please can someone explain this to me. I have been searching and cannot find a suitable answer!

    First of all i would like to pick my own colour that i use in a texture to not draw that colour on my quad. I know i can do this with the alpha test. I'm just not sure how to do it properly. I have been trying bright pink.

    Another problem i am having is that i don't think i am creating the tga texture correctly. How do i create a texture in photoshop with a proper Alpha channel that will work with my aplha test in my program?

    If you can answer either question i will stop pulling out my hair! lol

    I know i can use masks but i don't really want to have 2 images for each texture i use! All i am doing is experimenting with quads on the screen for what you would call a 2d shooter.

    Your time is very much appreciated!

    Werdy666 [img]/forum/images/%%GRAEMLIN_URL%%/laugh.gif[/img]

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001

    Re: Transparency in a texture

    Thats not quite how it works with GL (you are referring to a `colour-keying' method).

    In GL, as well as having a red, green and blue component for a texel, you can have an alpha component too. The alpha-test can not draw any given pixel where the given alpha value is zero (for example). To get rid of (say) all red texels, you will need some kind of pre-process to put zero alpha in those positions where the texel is the colour red.

    Look for some TGA loading\editing tutorials.

    Hope this helps.

  3. #3
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Bay Area, CA, USA

    Re: Transparency in a texture

    The texture environment specifies how texture is applied. You might want to use texture alpha and modulate but this will multiply colors and produce alpha fragments.

    There are other choices, from your description (and it's not completely clear)it sounds like a DECAL texture environment might be what you're looking for.

    As for alpha in a texture. You need to write to a format which supports transparency and load it as a 4 component image. You can paint alpha in photoshop as part of an image or to a layer mask. You can then save the image to a PNG image and the transparency information will be preserved. Then you read the png as an RGBA memory representation and specify that as the image array for the RGBA texture. The key is chosing a format that supports alpha information and loading it correctly to your image array.

Similar Threads

  1. Texture Transparency .BMP
    By Darius in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 12-12-2012, 07:18 PM
  2. Transparency using texture
    By Sarah Clough in forum OpenGL: Windows
    Replies: 4
    Last Post: 05-15-2007, 07:24 AM
  3. Phong transparency texture
    By Licu in forum COLLADA
    Replies: 1
    Last Post: 10-06-2006, 01:57 PM
  4. Transparency with a non-alpha texture?
    By wyrd in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-18-2004, 05:43 PM
  5. OpenGL window transparency and texture transparency
    By ramalhais in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-15-2002, 09:37 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