0
votes

I'm going to have meshes with several coplanar polygons, all lying in a certain plane, that I'm not going to be able to eliminate.

These polygons have a specific draw order. Some polygons are behind other polygons. If I turn off depth testing I'll have the effect I want, but I want to be able to position this mesh in a 3D scene.

I do not trust glPolygonOffset because I'll potentially have several of these overlapping polygons and am am worried about the cumulative effects of the offset.

1
"What methods are there to drawing coplanar polygons in OpenGL aside from glPolygonOffset and proper clipping, given I want the polygons drawn in a certain order?" - AJM

1 Answers

4
votes

If I turn off depth testing I'll have the effect I want, but I want to be able to position this mesh in a 3D scene.

Simply disable writing to z-buffer, without disabling depth test.

glDepthMask(GL_FALSE);

Make sure to render all polygons that doesn't require glDepthMask(GL_FALSE) before rendering any polygons with glDepthMask(GL_FALSE); Otherwise object will be incorrectly positioned.

If you can't do that, then you should change your geometry or use texture instead.

glDepthMask documentation