Results 1 to 4 of 4

Thread: Texturing with Alpha test

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002

    Texturing with Alpha test

    I was trying to draw a texture mapped polygon. Certain pixels in texture has Alpha value as 0( manually done to make transparent).
    Now the problem is it does not work.
    I have done,
    a. Enable ALPHA TEST
    b. Alpha function ( greater, 0.5)

    i have used
    0, GL_RGBA, image);
    tried with GL_DECAL, GL_MODULATE and GL_REPLACE!!
    but nothing is displayed. but if i mention 3rd paramenter in glTexImage2D as 3( instead of 4), the image is displayed but with all pixels( no transparency). Why is this?
    how come it works with 'components' as 3 even if image is RGBA?

    please help!!

  2. #2

    Re: Texturing with Alpha test

    My guess is that all pixels has alpha=0 in your image. You can check this by disabling the alpha test.

  3. #3
    Member Contributor
    Join Date
    Feb 2001

    Re: Texturing with Alpha test


    Oh, sorry

    Set the alpha test to be less or equal to instead of greater, and set the test value to 0. It wasn't working because you were telling it not to draw pixels with an alpha value of more than .5, and when it drew the 0 alpha texels, they were invisible anyway. If you use a visible alpha value, you should see an inverse image of what you want.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Arlon, Belgium

    Re: Texturing with Alpha test


    On my site, I've a little example who use the alpha chanel.

    The program displays a simple rotating tree and if you press 'A' key, you'll enable the alpjha test and if you press the 'Z' key, you'll disable de alpha test.

    "Download" section.

    Please, send me feedback ...

Similar Threads

  1. Alpha to coverage vs alpha test
    By imported_Groovounet in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 01-21-2008, 12:21 PM
  2. Alpha Test
    By Foxabilo in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 10-28-2005, 02:31 PM
  3. Can Alpha Test work the same way as Depth Test?
    By Rong Yao in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 05-13-2004, 02:40 PM
  4. Alpha test and early z test
    By crystall in forum OpenGL: Advanced Coding
    Replies: 15
    Last Post: 02-23-2004, 08:56 AM
  5. Alpha Test
    By Rong Yao in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 06-25-2001, 01:17 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