Results 1 to 3 of 3

Thread: how can i make surfaces transparent ?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    HK
    Posts
    2

    how can i make surfaces transparent ?

    If i want to make surfaces transparent, what
    do i have to do?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: how can i make surfaces transparent ?

    use alpha blending.

    enable blending and set the blend function:

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

    then draw anything you need, but remember to specify the alpha (opacity) value, maybe with a call to glColor4f()

    Dolo/\/\ightY
    Dolo/\/\ightY

  3. #3
    Member Contributor
    Join Date
    Feb 2000
    Location
    Brisbane,QLD, Australia
    Posts
    99

    Re: how can i make surfaces transparent ?

    Not to long ago i had this problem, Thanks to MikeC and some other ppls I got it sorted out.

    To use transperancy I first load a windows bitmap as my texture (RGB) transperancy does however require RGBA. So you need to create the A or Alpha channel yourself.

    So in my bitmap I put a color where I want transperancy I use 0,255,0 (pure green) After my bitmap is loaded i check each bit of bitmap data for RED=0, GREEN=255, and BLUE=0, If this is the case then i set in my ALPHA channel bit to 0 (fully transperant) all the way to 255 (no transperancy)

    In the above you need to allocate enough memory for the BMP and the extra ALPHA channel or else you will do some nasty things to your memory.

    Once you have loaded succesfully you need to enable Blending - glEnable (GL_BLEND);
    and set your blending mode -
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

    Your polys should be drawn from furthest to closet when using this or you will find some objects get blended incorrectly.

    Hope to help.
    Dan S.


    [This message has been edited by dans (edited 02-23-2000).]

Similar Threads

  1. make some pixels transparent
    By blueepl in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 05-27-2006, 09:16 PM
  2. Make color transparent
    By Hylke Donker in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 03-23-2005, 06:44 AM
  3. What!?!? Why on Earth won't it make a quad transparent?
    By Andrewinator in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-12-2003, 12:24 PM
  4. Is it possible load a bmp and make it transparent?
    By John Jenkins in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 11-06-2002, 08:05 PM
  5. Perpixel lighting and transparent surfaces
    By LaBasX2 in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 03-24-2002, 09:01 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