OLD | NEW |
1 // | 1 // |
2 // Book: OpenGL(R) ES 2.0 Programming Guide | 2 // Book: OpenGL(R) ES 2.0 Programming Guide |
3 // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner | 3 // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner |
4 // ISBN-10: 0321502795 | 4 // ISBN-10: 0321502795 |
5 // ISBN-13: 9780321502797 | 5 // ISBN-13: 9780321502797 |
6 // Publisher: Addison-Wesley Professional | 6 // Publisher: Addison-Wesley Professional |
7 // URLs: http://safari.informit.com/9780321563835 | 7 // URLs: http://safari.informit.com/9780321563835 |
8 // http://www.opengles-book.com | 8 // http://www.opengles-book.com |
9 // | 9 // |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 GLbyte vShaderStr[] = | 64 GLbyte vShaderStr[] = |
65 "attribute vec4 a_position; \n" | 65 "attribute vec4 a_position; \n" |
66 "attribute vec2 a_texCoord; \n" | 66 "attribute vec2 a_texCoord; \n" |
67 "varying vec2 v_texCoord; \n" | 67 "varying vec2 v_texCoord; \n" |
68 "void main() \n" | 68 "void main() \n" |
69 "{ \n" | 69 "{ \n" |
70 " gl_Position = a_position; \n" | 70 " gl_Position = a_position; \n" |
71 " v_texCoord = a_texCoord; \n" | 71 " v_texCoord = a_texCoord; \n" |
72 "} \n"; | 72 "} \n"; |
73 | 73 |
| 74 // TODO(alokp): Shaders containing "precision" do not compile. |
74 GLbyte fShaderStr[] = | 75 GLbyte fShaderStr[] = |
75 "precision mediump float; \n" | 76 "//precision mediump float; \n" |
76 "varying vec2 v_texCoord; \n" | 77 "varying vec2 v_texCoord; \n" |
77 "uniform sampler2D s_texture; \n" | 78 "uniform sampler2D s_texture; \n" |
78 "void main() \n" | 79 "void main() \n" |
79 "{ \n" | 80 "{ \n" |
80 " gl_FragColor = texture2D( s_texture, v_texCoord );\n" | 81 " gl_FragColor = texture2D( s_texture, v_texCoord );\n" |
81 "} \n"; | 82 "} \n"; |
82 | 83 |
83 GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0 | 84 GLfloat vVertices[] = { -0.5f, 0.5f, 0.0f, // Position 0 |
84 0.0f, 0.0f, // TexCoord 0 | 85 0.0f, 0.0f, // TexCoord 0 |
85 -0.5f, -0.5f, 0.0f, // Position 1 | 86 -0.5f, -0.5f, 0.0f, // Position 1 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 168 |
168 // Delete texture object | 169 // Delete texture object |
169 glDeleteTextures ( 1, &userData->textureId ); | 170 glDeleteTextures ( 1, &userData->textureId ); |
170 | 171 |
171 // Delete VBOs | 172 // Delete VBOs |
172 glDeleteBuffers ( 2, userData->vboIds ); | 173 glDeleteBuffers ( 2, userData->vboIds ); |
173 | 174 |
174 // Delete program object | 175 // Delete program object |
175 glDeleteProgram ( userData->programObject ); | 176 glDeleteProgram ( userData->programObject ); |
176 } | 177 } |
OLD | NEW |