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: Depth buffer rendered over objects

Threaded View

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2013
    Posts
    18

    Depth buffer rendered over objects

    Hello,

    I'm having a bit of a problem with the depth buffer. When I'm using blending, it seems that the depth buffer gets mixed together with the blended image. As soon as I call glDisable(GL_DEPTH_TEST), the entire contents of the depth buffer get written over the render target. If I keep the depth buffer on but disable blending, everything is fine. Here's what I mean: http://i42.tinypic.com/2n1gkld.png

    Here's the render code:
    Code :
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glDisable(GL_DEPTH_TEST);
     
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     
    // render the particles
    glBindVertexArray(particles_);
    glDrawArraysInstanced(GL_TRIANGLES, 0, model_.getVertCount(), NUM_OF_PARTICLES);
     
    glDisable(GL_BLEND);
    glEnable(GL_DEPTH_TEST);

    No clue as to what's going on. Any help would be appreciated!

    Thanks in advance!

    EDIT: Just before I went to bed I got an idea and it worked: enabling back face culling removed the issue. I was trying to find a way to delete the topic as to not clutter the forums but I couldn't find a button for it. Anyway, if anyone experiences similar artifacts then here's your solution! ^^
    Last edited by dr4cula; 08-28-2013 at 03:38 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
  •