I don’t particularly speak C++ or OpenGL, but I’ve been curiously looking over some of the Corona source to see if it would be feasible to extend the newPolygon() implementation to do pixel depth testing. My thinking is that if when defining the vertices of a polygon, you can also (optionally of course) pass a z value for each vertex, then the actual OpenGL render of that polygon should be able to depth test each pixel against previously drawn polygons and skip the rendering of individual pixels that would be behind those already drawn. Long story short, this would allow my 3D engine to leave the handling of intersecting faces up to OpenGL which would be hugely advantageous for performance.
To the point, my digging has determined that the OpenGL term for this is a “polygon_offset”, and I’ve just stumbled onto this file within the Corona source which appears to hint at an implementation of some sort?
Am I barking up the wrong tree, or is depth testing already actually incorporated, at least to some extent? Perhaps the renderer is capable of this but the newPolygon call doesn’t currently use it, or does but doesn’t expose the capability to Lua?
If somebody more competent than me doesn’t mind doing a little digging themselves I’d appreciate the feedback. Or if somebody at Coronalabs could explain how this works?
Much appreciated.