Results 1 to 5 of 5

Thread: Transparent Imaging

  1. #1
    Guest

    Transparent Imaging

    Hi,
    Im trying to use a texture (loaded bitmap, and I set the white pixels Alpha's to zero,therefore they are transaprent). Ive wrapped it around a quad ( Im actually creating a 2d game, and drawPixels is HORRIBLY sloooow,so I breifly read a few posts here and saw a mention of how using texturing and quads is much faster). However,
    how do I disable the acual quad color? Ive tried to set its alpha value to zero, however my texture then dissapears. Setting it to black defeats the purpose since you still have a black rectangle covering whatever is going to be behind it? I assume it has something to do with the texturing properties but Im having difficulty figuring it out...please help..thanx.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: Transparent Imaging

    You set the alpha to zero for only those pixels you do want drawn, and maxium alpha for those you do want drawn. Then use alpha testing to remove the unwanted pixels rather than alpha blending.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2000
    Location
    Brazil
    Posts
    102

    Re: Transparent Imaging

    Originally posted by DFrey:
    You set the alpha to zero for only those pixels you do want drawn, and maxium alpha for those you do want drawn. Then use alpha testing to remove the unwanted pixels rather than alpha blending.
    how can i do that dfrey ???

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    625

    Re: Transparent Imaging

    On NeHe website there's a tutorial on alpha testing... I still have to look at it but I hope it will help you.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    431

    Re: Transparent Imaging

    Find an online copy of the red book (search the discussion board for a link) and look up the section on texture functions (i.e. glTexEnv). This has an explanation of which texture functions can be applied and their respective functions. It won't take you long to work out what texture function you want.

    At a guess, you shouldn't have to worry about trying to make the quad alphas anything special. Try using glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE). This gives a value of C = Ct, A = At for the outgoing fragment, where Ct and At are the incoming colour and alpha texture values i.e. the quad's colour/alpha has no bearing on the outgoing result fragment. Then, you can use either alpha test or blending to give you the effect you want. In this way, using blending you can have various degrees of opaqueness, or using alpha test you can have either visible texture or none at all. Of course, you can combine alpha test and blending as well for other effects.

    Hope that helps.

Similar Threads

  1. Radar Display Imaging
    By Brad Howes in forum OpenGL: Advanced Coding
    Replies: 17
    Last Post: 05-07-2007, 05:45 PM
  2. Problems with imaging
    By zadeh79 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-20-2006, 02:50 PM
  3. Imaging subset extension on NV&ATI
    By imported_Ffelagund in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 08-06-2004, 03:45 PM
  4. imaging in openGL
    By romeoneverdies in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-17-2002, 10:00 PM
  5. PostRendering: Imaging subset.
    By coco in forum OpenGL: General
    Replies: 5
    Last Post: 01-10-2001, 02:04 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