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 2 of 2

Thread: How to draw fade-in/out Masked 2D image

  1. #1
    Junior Member Newbie
    Join Date
    May 2003
    Location
    chiba
    Posts
    18

    How to draw fade-in/out Masked 2D image

    Hello.

    To draw masked 2D image, I'm using next code:
    (I study from next web site : http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=20, thanks)
    ------------------------------
    //draw mask
    glBlendFunc(GL_DST_COLOR, GL_ZERO);
    glBindTexture(GL_TEXTURE_2D, mask_id); //bind mask to current texture
    glCallList(5); //draw textured quad

    //draw image
    glBlendFunc(GL_ONE, GL_ONE);
    glBindTexture(GL_TEXTURE_2D, image_id); //bind image to current texture
    glCallList(5); //draw textured quad
    ---------------
    above code draw no fade-in/out 2D Image.

    By the way, I want to draw fade-in/out masked 2D image. How can I set glBlendFunc?

    I tryed next code, but I don't get fade-in/out 2D masked iamge.
    -------------------------
    //draw mask
    glBlendFunc(GL_DST_COLOR, GL_ZERO);
    glBindTexture(GL_TEXTURE_2D, mask_id);
    glCallList(5);

    //draw image
    //glBlendFunc(GL_ONE, GL_ONE);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE); //<-add
    glBindTexture(GL_TEXTURE_2D, image_id);
    glColor4f(1.0f, 1.0f, 1.0f, alpha); //<- set alpha factor to quad for 2D image.
    glCallList(5);
    -------------------------------
    I should guess that If mask-image's black color can fade-in, we can get fade-in/out masked 2D image.

    I want to understand how we set glBlendFunc in this case, to get fade-in/out Masked 2D images.

    If you have any suggestion, I want to listen your suggestion very much.

    sorry, my broken English.
    Thanks.

    [This message has been edited by mdive (edited 06-18-2003).]

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,070

    Re: How to draw fade-in/out Masked 2D image

    I have some code I was playing around with fading in two textures, one fades in the other fads out.

    If you are interested drop me an e-mail and I will send it to you.

    Just make sure if it is an e-mail, that openGL is in the subject line.

Posting Permissions

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