Results 1 to 2 of 2

Thread: Turning specific color in Texture into transparency

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2004
    Location
    Wil
    Posts
    3

    Turning specific color in Texture into transparency

    Hi,

    I've a question. How can i define that a specific color in a texture is transparent. Example: I've got a texture with the white character R on it and it has got a purple backgroud. now i don't want the purple part to be visible, i'd like it to be transparent.

    Can somebody help???

    Pleyse excuse my really bad english

  2. #2
    Junior Member Newbie
    Join Date
    Dec 2001
    Location
    Switzerland
    Posts
    28

    Re: Turning specific color in Texture into transparency

    Short answer: use an alpha channel.

    Long(ish) answer: Create the texture in RGBA format. Set the A value to 255 to mean visible and 0 to mean completely transparent. Enable ALPHA_TEST. Set AlphaFunc to GREATER, 0.5 (and/or enable BLEND and set BlendFunc to SRC_ALPHA, ONE_MINUS_SRC_ALPHA in case you want semi-transparent parts too). Make sure TexEnv for that texture is set to REPLACE or you will have to think about setting Color4 in a sensible way too.

Similar Threads

  1. Creating a rectangle with a specific color
    By joatmon in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-02-2013, 07:54 PM
  2. Color-key transparency for a texture image
    By opusGlass in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 07-31-2013, 02:09 PM
  3. Replies: 2
    Last Post: 11-23-2011, 04:30 AM
  4. Color interpolation after changing a specific valu
    By trin82 in forum OpenGL: User Software
    Replies: 0
    Last Post: 08-23-2011, 03:36 AM
  5. Preventing one specific color to be written
    By edotorpedo in forum OpenGL: General
    Replies: 2
    Last Post: 09-26-2000, 04:33 PM

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