Results 1 to 9 of 9

Thread: Transparency

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2003
    Posts
    8

    Transparency

    hi,
    i just want to make some parts of a polygon complete transparent (cliping ?).
    my problem is, that the transparent parts are always a little bit darker than the background. is this normal ? cant i get rid of the "shaddows" ?

  2. #2
    Member Contributor
    Join Date
    May 2003
    Location
    Cologne / Germany
    Posts
    66

    Re: Transparency

    What kind of BlendFunction do you use ?

    cu
    Tom

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2003
    Posts
    8

    Re: Transparency

    hi,
    first i enable BL_BLEND;
    then DepthFunc(GL_LEQUAL);...
    glDepthRange(0,1);
    glEnable(GL_DEPTH_TEST);
    glBlendFunc(GL_DST_COLOR,GL_ZERO);
    glBindTexture....
    then i paint the first quad

    then i change the

    glBlendFunc(GL_ONE,GL_ONE);

    and paint the next Quad on the same position.

    after that i disable the Blend and DepthTest.

    if it is important: i use loaded "tga" and its on a 2D environment.

    is there something wrong with it ?

  4. #4
    Guest

    Re: Transparency

    Hmm. It appears you are trying to mask out all the black pixels in the texture. If that's the case, make sure your tga file is in fact using black, and not using alpha transparency. If it is using alpha transparency, then either using an alpha test (instead of the blending) or fix the file.

  5. #5
    Member Contributor
    Join Date
    Feb 2003
    Location
    Mitishy
    Posts
    59

    Re: Transparency

    glBlendFunc(GL_DST_COLOR,GL_ZERO);
    i'm not shure this will work!
    glBlendFunc(src,dst)!!!!!!!!
    so maybe this: glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR);
    if your texture has alpha channel do this like:
    glEnable(GL_ALPHA_TEST);
    glAplhaFunc(GL_LESS, 0.5f); // discard all fragments which alpha value is lesser than 0.5
    render();
    glDisable(GL_ALPHA_TEST);

  6. #6
    Junior Member Newbie
    Join Date
    Aug 2003
    Posts
    8

    Re: Transparency

    okay, i'll try this this afternoon.
    the tga is a uncompressed tga. the color is RGB and its "real" black (0,0,0).

    thanks

  7. #7
    Junior Member Newbie
    Join Date
    Aug 2003
    Posts
    8

    Re: Transparency

    it worked. now i used tga with alpha. there was no problem with it. thanks

    can anyone tell me how to load tgas or bmps in any size ?

  8. #8
    Member Contributor
    Join Date
    Feb 2003
    Location
    Mitishy
    Posts
    59

    Re: Transparency

    what do you mean in "...load tgas..."?
    if you mean load them to gl then:
    use gluBuild2DMipmaps to use not square-sized textures
    or use glTexImage with GL_TEXTURE_RECTANGLE_NV... or rescale image by hand

    [This message has been edited by gvm (edited 10-21-2003).]

  9. #9
    Junior Member Newbie
    Join Date
    Aug 2003
    Posts
    8

    Re: Transparency

    yes that i mean. i will look for this

Similar Threads

  1. NSOpenGLView visual transparency vs. mouse transparency
    By hidefromkgb in forum OpenGL: macOS
    Replies: 1
    Last Post: 05-12-2015, 01:05 PM
  2. transparency!
    By thasadams in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 05-27-2003, 05:54 AM
  3. transparency
    By drummerboy_2002 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 07-28-2002, 01:22 AM
  4. OpenGL window transparency and texture transparency
    By ramalhais in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-15-2002, 09:37 AM
  5. Transparency
    By in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 07-05-2001, 06:03 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