4

I have a question with alpha blending in openGL...

I've tried some stuff for drawing transparent objects... I've seen a nice (ideal) result by disabling GL_DEPTH_TEST before drawing the transparent faces and re-enable GL_DEPTH_TEST again back after drawing the transparent face...

Obviously I've noticed that depending on the order that I draw the different faces I got a result or another...

However I've decided simply to draw solid faces first with GL_DEPTH_TEST enabled and after the transparent faces with GL_DEPTH_TEST disabled...

So, obviously if I draw transparent faces with GL_DEPTH_TEST disabled I see transparent faces which are inside, (for example a cube), then

So, my question is... Is this correct? Does OpenGL have a "magic" way to order the opaque and transparent faces automaticly?

Toni Ruža
  • 7,462
  • 2
  • 28
  • 31
daleotar
  • 325
  • 3
  • 7

2 Answers2

5

Does OpenGL have a "magic" way to order the opaque and transparent faces automaticly?

No. You must sort transparent objects yourself. Or you can use an order-independent transparency algorithm. There are several available, but none of them are "magic" and most of them take up lots of performance.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
0

Despite it is not the ideal result I got nice results by drawing first opaque faces and then transparent faces...

daleotar
  • 325
  • 3
  • 7