Weird overlap effect

When I enable depth testing in my program I get this weird overlap effect. I gather it’s something to do with blending but I don’t know much about texture blending.

In the picture examples of my problem are circled.

Any help is much appreciated!
Thanks,
Rowan.

PS: As you can tell from the picture my top down tree sprites are awful. Do you know where I can get some the look decent.

Looks to me as if your transparent objects are writing to the depth buffer and/or are not rendered from back to front.

Why shouldn’t a transparent object write to depth buffer? How else am I meant to change the drawing order without major changes to my code?

Why shouldn’t a transparent object write to depth buffer?

Because then the algorithm doesn’t work.

If you draw something transparent into the depth buffer, and then draw something (transparent or opaque) behind it, OpenGL will dutifully not draw it at all.

OpenGL only knows about the triangle it’s currently rendering and the framebuffer. It doesn’t know what has been rendered “transparently” before.

This is a common, well-understand thing about transparency via blending. You must render all transparent objects last. You must turn off depth buffering, and you must sort transparent objects back-to-front. There is no other way to handle this.

Hi,

just an other idea.
maybe your blendfunc is not set correctly.

cu
uwi