June 2013
Intermediate to advanced
346 pages
8h 42m
English
Let’s update our code to add in an orthographic projection and fix that squashed table.
The first thing we need to do is update the shader so that it uses our matrix to transform our positions. If you don’t yet have the AirHockeyOrtho project open (we created this project back at the beginning of this chapter), go ahead and open it up. Open simple_vertex_shader.glsl and update it as follows:
| AirHockeyOrtho/res/raw/simple_vertex_shader.glsl | |
| | uniform mat4 u_Matrix; |
| | |
| | attribute vec4 a_Position; |
| | attribute vec4 a_Color; |
| | |
| | varying vec4 v_Color; |
| | |
| | void main() |
| | { |
| | v_Color = a_Color; |
| | |
| | gl_Position = u_Matrix * a_Position; |
| | gl_PointSize = 10.0; |
| | } |
We’ve added a new uniform definition, u_Matrix ...
Read now
Unlock full access