residualvm/residualvm — pull request #864 by chkr-private (2014-05-01 11:06:41+00:00)
Title: EMI: Change drawing order of faces

If multiple faces of one model are referring to the same triangles, let
them overwrite each other so that the latest one will be visible. For
this purpose glDepthFunc is changed from GL_LESS to GL_LEQUAL so
that subsequent drawing attempts for the same triangle are not ignored by
the depth test.

This fixes the issue of the colored leg of the monkey bot in the end
scenes: the leg is drawn using color maps by the first face and using
textures by a following face.

The commit fixes the problem for the OpenGL and the OpenGLS renderer. The "colored leg" issue did not happen with TinyGL.

It looks like that TinyGL is already using a hard-coded equivalent to GL_LEQUAL:

#define ZCMP(z, zpix) ((z) >= (zpix))

so we could consider to use GL_LEQUAL unconditional for all game engines.

The current proposal only effects EMI in order to be less invasive.