Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: blending and masking

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2002
    Posts
    1

    blending and masking

    hi,
    i managed to load a blended image...its basically a cactus tree with a black background. The image loads blended but the problem is that black part is completely gone(which is fine)and the green part is partially blended. I want the green part to be solid(not blended at all).
    I also tried loading a picture with a masked image on it and loading both these images on separate quads....but the white appears prominent....
    i figured what i need to do is....
    -load an image of the green cactus with a black background( with SRC_ALPHA,ONE)

    -load an image with a white background and the cactus part in black(with what??)

    for the second image i need to make the white transparent and black solid...
    how do I do that??

    if all that is confusing my question would simply be...i want to load the picture of a cactus onto a quad and not make it look square but make it look like the actual shape of the cactus.

  2. #2
    Guest

    Re: blending and masking

    Use RGBA (not RGB) texture map. When reading the image of the cactus, check the color of the pixel, and if it is the background color then write 0 to the alpha component, else write 1.

    dav

  3. #3
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    353

    Re: blending and masking

    Or make a mask of the picture with the stuff you don't want to see white and the stuff you do white. Draw this texture using the blendfunc glBlendFunc(GL_DST_COLOR,GL_ZERO)
    Then change the depth testing function to GL_EQUAL and draw you actual picture maing sure the stuff you don't want is black, using the blendfunc glBlendFunc(GL_ONE, GL_ONE). change back the depth function to GL_LESS.

    This method works but is far slower requireing 2 textures to be rendered and 4 state changes.
    Reality is for idiots only the best over come it!

  4. #4
    Intern Newbie
    Join Date
    Jan 2001
    Location
    Russia,Kazan
    Posts
    33

    Re: blending and masking

    Thanx what's very useful!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •