Results 1 to 2 of 2

Thread: alpha blending

  1. #1
    Guest

    alpha blending

    i know that this question pops up numerous times, but i really am stumped.

    i have a method that draws a chain (3 torii). i need it to be drawn both opaque and translucent. this chain moves around, and i wanted to draw the beginning and ending states of my animation translucent, while the current frame of where the chain is is drawn opaque.

    so my paintGL is essentially (half pseudocode)

    paintGL()
    {
    drawChain();
    drawTranslucentChain( beginningTime );
    drawTranslucentChain( endTime );
    }

    drawChain()
    {
    uses only Color3f() statements
    }

    drawTranslucentChain()
    {
    glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT );

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

    // set alpha bit
    glColor4d( 0., 0., 0., 0.1 );
    glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE );
    drawChain();
    glPopAttrib();
    }

    for some reason, though, the ending and beginning chains are drawn FULL alpha! why is this, even though the ColorMask is turned on?

    Much thanks,
    Jon

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: alpha blending

    Ok, your use of glColorMask most likely isn't needed at all from your description of what you want. And second of all, your transparent function simply uses the nontransparent function to draw the torii, and it uses the glColor3f function, which itself calls into use an implicit value of 1 for the alpha component.

Similar Threads

  1. alpha blending
    By pommeC in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-05-2018, 05:22 AM
  2. Replies: 3
    Last Post: 06-16-2011, 12:51 PM
  3. alpha blending without modifying destination alpha
    By GordAllott in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-21-2009, 04:15 AM
  4. Source Alpha Blending without an Alpha Buffer
    By niallm in forum OpenGL ES
    Replies: 1
    Last Post: 06-18-2009, 02:51 AM
  5. alpha blending bug?
    By in forum OpenGL: User Software
    Replies: 1
    Last Post: 02-12-2001, 06:24 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