Results 1 to 4 of 4

Thread: Decaling with GL_ARB_multitexture

  1. #1
    Member Newbie
    Join Date
    Dec 2000
    Posts
    44

    Decaling with GL_ARB_multitexture

    I am testing decaling with GL_ARB_multitexture. I have a base texture with an all white alpha layer. I have a decal texture with white at the symbol and black else where in the alpha layer.

    Using the old fashion multipass method I would
    disable depth test
    glBindTexture( base texture )
    glTexEnv( ,, GL_REPLACE )
    draw quad

    enable alpha testing
    glBindTexture( decal texture )
    glTexEnv( ,, GL_REPLACE )
    draw quad again

    However a similar approach doesn't seem to work with multitexturing.
    disable depth test
    glActiveTextureARB( unit 0 )
    glBindTexture( base texture )
    glTexEnv( ,, GL_REPLACE )

    glActiveTextureARB( unit 1 )
    enable alpha testing
    glBindTexture( decal texture )
    glTexEnv( ,, GL_REPLACE )

    draw quad including glMultiTexCoord*
    disable alpha testing

    Now all I see the decal and no base texture. I suspect pixels from the base texture made it past unit 0 but got discarded by unit 1 because either the pixel was:
    a) under the decal and got overwritten or
    b) located at a point where there was a decal alpha value of zero and failed the alpha test.

    What's the way around this while still using multitexturing?

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Decaling with GL_ARB_multitexture

    try GL_MODULATE instead of GL_REPLACE

  3. #3
    Member Newbie
    Join Date
    Dec 2000
    Posts
    44

    Re: Decaling with GL_ARB_multitexture

    No go with GL_MODULATE but GL_DECAL did work. I thought GL_REPLACE and GL_DECAL did the same thing but I guess not.

    Thanks for the suggestion tho.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jun 2000
    Location
    B.C., Canada
    Posts
    367

    Re: Decaling with GL_ARB_multitexture

    GL_REPLACE and GL_DECAL aren't the same. With GL_REPLACE, the current texture replaces all of the color information from the previous texture, including alpha. GL_DECAL blends the current texture in with the previous texture based on the alpha channel, which is why it works for you.

    j

Similar Threads

  1. HELP! DECALING...
    By KeSh in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-27-2004, 10:17 AM
  2. GL_ARB_multitexture with cygwin
    By Alcionei Estevam Jr in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-20-2003, 11:21 AM
  3. Decaling with Stencil (Programming with OpenGL: Advanced Rendering )
    By Olumide in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-09-2002, 12:05 AM
  4. GL_ARB_multitexture decaling
    By Crunch in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 03-30-2001, 08:39 AM
  5. GL_ARB_multitexture
    By Mad Max in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-23-2000, 08:12 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