In OpenGL, is it possible, to draw a sequence of polygons that doesn't check for depth (so they will always be drawn in front of other polygons drawn before it, regarding of their z position)
but also at the same time, they still write to the depth buffer?
I suppose this is doable using shaders, but right now I have no access to that.
Not strictly speaking (from the man page):
the depth buffer is not updated if the depth test is disabled.
But... you can have the depth test enabled, while not having any fragment fail the test:
glDepthFunc(GL_ALWAYS);
glEnable(GL_DEPTH_TEST);
Of course, you get the last Z written by doing that, not the closest to the view.
You can only achieve that using two passes. First one is to populate the depth buffer only using a color mask:
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
Second pass you enable color writing again, disable depth test and render your sequence of polygons in order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With