Transforming a Coordinate from the Shader to the Screen

We are now familiar with normalized device coordinates, and we know that in order for a vertex to display on the screen, its x, y, and z components all need to be in the range of [-1, 1]. Let’s take a look at the following flow chart to review how a coordinate gets transformed from the original gl_Position written by the vertex shader to the final coordinate onscreen:

images/3D/CoordinateTransformation.png

There are two transformation steps and three different coordinate spaces.

Clip Space

When the vertex shader writes a value out to gl_Position, OpenGL expects this position to be in clip space. The logic behind clip space is very ...

Get OpenGL ES 2 for Android now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.