PDA

View Full Version : Faces rendering on top of each other



Grozzz
06-08-2016, 05:17 AM
Hi, I am having difficulty with rendering two simple cuboids which share a common face. This face, when rendered causes glitches, the top one is semi-transparent and the bottom is solid colour and it renders as if the solid portion below overlays on top of the semi-transparent face.

I have cured the issue with the edges overlapping by using the glPolygonOffset.

Is there anyway I can cure this problem?

cheers

john_connor
06-08-2016, 05:27 AM
you have to render your scene twice:
1. render all opaque primitives
2. render all transparent primitives

but for the 2. pass you have to sort all primitives so that you start rendering the nearest once
http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-10-transparency/