Graphics Programs Reference
object rendered by the last program is considered to lie above other objects (that is,
closer to the viewer) rendered using previous programs.
Another interesting point is that depth testing may seem to give unexpected results
in NDCS , because NDCS has a left handed coordinate system. This can be corrected
by adding the line “ GLES20.glDepthRangef(1, 0); ” after enabling
GL_DEPTH_TEST ; doing so changes NDCS into a right handed coordinate system.
As discussed in the previous topic, we can also do this by using an MVPmatrix
to transform per-vertex positions. To understand this more clearly, go through the
Renderer class ( GLES20Renderer ) inside the GL DEPTH TEST application
( Chapter3/gldepthtest.zip ). Each of the programs used in this class
renders a line primitive ( Figure 3-24 ) and uses an MVPmatrix to transform per-vertex
In this chapter you learned more about the OpenGL ES 2.0 environment on Android
▪ EGL , the software that helps us connect OpenGL ES 2.0 API
▪ GLSurfaceView class , to manage the EGL window i.e. rendering
▪ renderer thread, which renders 3D graphics on the EGL window