June 2013
Intermediate to advanced
346 pages
8h 42m
English
Before we can draw the texture to the screen, we’ll have to create a new set of shaders that will accept a texture and apply it to the fragments being drawn. These new shaders will be similar to the ones we’ve been working with until now, with just a couple of slight changes to add support for texturing.
Create a new file under your project’s /res/raw/ directory, and call it texture_vertex_shader.glsl. Add the following contents:
| AirHockeyTextured/res/raw/texture_vertex_shader.glsl | |
| | uniform mat4 u_Matrix; |
| | |
| | attribute vec4 a_Position; |
| | attribute vec2 a_TextureCoordinates; |
| | |
| | varying vec2 v_TextureCoordinates; |
| | |
| | void main() |
| | { |
| | v_TextureCoordinates = a_TextureCoordinates; |
| | gl_Position ... |
Read now
Unlock full access