Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: texture mapping of two planes

  1. #11
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: texture mapping of two planes

    Ah so your image have no proper alpha ?
    This is a problem you have to fix, and keep the blendfunc to the one I proposed.
    Maybe just doing glColor4f(1.0,1.0,1.0,0.5) to make stuff uniformly half-transparent.

    Can you show does this do exactly :
    SetAlphaMatch(TRUE, 0.1, 0.1, 0.1);

    Is that an exact match ? Or that any texel darker than this will be transparent ?

  2. #12
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    155

    Re: texture mapping of two planes

    Hi, I hv used the following:

    glColor4f(1.0,1.0,1.0,0.5);
    glEnable(GL_BLEND);
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    It works, but looks a bit dark. I could not manage to work with the following function:
    SetAlphaMatch(TRUE, 0.1, 0.1, 0.1);

    I think it is supposed to control the alpha of a particular texture.

    As my first plane deforms and penetrates the second plane, there appears another blending. I don't want it happen. How can that be done?

  3. #13
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: texture mapping of two planes

    OpenGL Blending is order-dependent.
    Be sure to draw back to front, otherwise it does not work. The depth buffer works only for opaque rendering, translucent surfaces need more complex structures, search for "order-independent transparency".

    It seems you are at a dead-end, can you explain the high level concept being your needs, maybe there are better solutions ?

  4. #14
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    155

    Re: texture mapping of two planes

    Actually now what I want is:
    when the front plane is pressed and crosses the back plane, the colored box will not appear. Can that be done? What would be condition for this kind of blending?

  5. #15
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    155

    Re: texture mapping of two planes

    Hello, I have some simple questions about texture. How can I understand whether my texture has alpha value or not? How can I separate color of a texture for different points as I need to differentiate white portion of the texture from other portions? Questions may be too simple but I really do need to clarify these things.

  6. #16
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,793

    Re: texture mapping of two planes

    How can I understand whether my texture has alpha value or not?
    You gave the texture data to OpenGL, didn't you? You told OpenGL what image format to use, yes? If you don't ask for alpha, you don't get alpha.

  7. #17
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    155

    Re: texture mapping of two planes

    Ok, I understand. I need to add alpha to have some transparency effect. But how can I separate RGB values of a certain point of texture?

Posting Permissions

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