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: Texture Overlay

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2005
    Posts
    21

    Texture Overlay

    I'm trying to overlay a texture ontop of another in a fragment shader. Problem is that it becomes transparent around the "edges" of the top texture.

    Code :
    tColor1 = texture2D(bTexture, vec2(gl_TexCoord[0]));
    tColor2 = texture2D(tTexture, vec2(gl_TexCoord[1]));
     
    gl_FragColor = tColor1 * ( 1.0 - tColor2.a )+ tColor2 * tColor2.a;

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2005
    Posts
    21

    Re: Texture Overlay

    Nevermind
    Code :
    gl_FragColor = vec4((vec3(tColor1) * ( 1.0 - tColor2.a )+ vec3(tColor2) * tColor2.a)*gl_Color,tColor1.a);
    Why do you always figure things out as soon as you post them.

Posting Permissions

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