Results 1 to 2 of 2

Thread: GL_DEPTH_TEST affects blend result

  1. #1
    Junior Member Newbie
    Join Date
    May 2013

    GL_DEPTH_TEST affects blend result

    While doing a simple blend operation, textured quad over background:

    Code :
    glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );  // texture is pre-multiplied
    // texture
    glActiveTexture( GL_TEXTURE0 );
    glEnable( GL_DEPTH_TEST );
    glDepthFunc( GL_ALWAYS );
    // draw quad
    glBindTexture( GL_TEXTURE_2D, textureId ); // this bind will stop the pipeline if the pbo to texture update isn't finished
    CORE_GL_CHECK( "bind texture" );
    painter->setUserEffect( );
    quadData.draw(, 0, quadData.indexCount(), QGL::TriangleStrip, 1.0 );
    glDisable( GL_DEPTH_TEST );
    glBindTexture( GL_TEXTURE_2D, 0 ); // unbind texture

    If the DEPTH_TEST is removed a nasty black border affects the blend operation, see the right image in the attachment.

    Any ideas? I'm trying to track down why it happens, it's most likely related to misuse of glcalls but I can't find where.



  2. #2
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    UK, London
    For most "2D" operations you usually don't enable depth testing, or at the very least disable writing to the depth buffer.
    gldepthmask (GL_FALSE)

Similar Threads

  1. Transforming the 3D model affects the shadow map
    By ehsan2004 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 07-23-2011, 03:28 PM
  2. Viewport position and scaling affects objects?
    By RedTulips in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-15-2009, 06:28 PM
  3. glDetachObjectARB on ATI - affects link state !!!
    By k_szczech in forum OpenGL: GLSL
    Replies: 1
    Last Post: 02-25-2006, 09:07 PM
  4. Clipping affects graphics performance
    By in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-29-2005, 06:30 AM
  5. glTexParameter affects render/texture state?
    By Stephen_H in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-24-2003, 07:05 PM

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