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! ^^