LWJGL Forum

Programming => OpenGL => Topic started by: Andrew_3ds on February 10, 2015, 04:34:32

Title: Order independent blending?
Post by: Andrew_3ds on February 10, 2015, 04:34:32
The transparency in my game works partially, but if a transparent sprite goes behind another transparent sprite that is being drawn second, it will overlap the other one even though it is transparent.
Here is an example:
(http://i.imgur.com/cosZTZI.png)

I am using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) for my blending mode. Is there a way to fix this easily?
Title: Re: Order independent blending?
Post by: Cornix on February 10, 2015, 10:58:57
You have to sort transparent sprites by their distance to the camera.