| 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 11 matching lines...) Expand all Loading... |
| 22 int stInit ( ESContext *esContext ) | 22 int stInit ( ESContext *esContext ) |
| 23 { | 23 { |
| 24 STUserData *userData = esContext->userData; | 24 STUserData *userData = esContext->userData; |
| 25 GLbyte vShaderStr[] = | 25 GLbyte vShaderStr[] = |
| 26 "attribute vec4 a_position; \n" | 26 "attribute vec4 a_position; \n" |
| 27 "void main() \n" | 27 "void main() \n" |
| 28 "{ \n" | 28 "{ \n" |
| 29 " gl_Position = a_position; \n" | 29 " gl_Position = a_position; \n" |
| 30 "} \n"; | 30 "} \n"; |
| 31 | 31 |
| 32 // TODO(alokp): Shaders containing "precision" do not compile. |
| 32 GLbyte fShaderStr[] = | 33 GLbyte fShaderStr[] = |
| 33 "precision mediump float; \n" | 34 "//precision mediump float; \n" |
| 34 "uniform vec4 u_color; \n" | 35 "uniform vec4 u_color; \n" |
| 35 "void main() \n" | 36 "void main() \n" |
| 36 "{ \n" | 37 "{ \n" |
| 37 " gl_FragColor = u_color; \n" | 38 " gl_FragColor = u_color; \n" |
| 38 "} \n"; | 39 "} \n"; |
| 39 | 40 |
| 40 GLfloat vVertices[] = { | 41 GLfloat vVertices[] = { |
| 41 -0.75f, 0.25f, 0.50f, // Quad #0 | 42 -0.75f, 0.25f, 0.50f, // Quad #0 |
| 42 -0.25f, 0.25f, 0.50f, | 43 -0.25f, 0.25f, 0.50f, |
| 43 -0.25f, 0.75f, 0.50f, | 44 -0.25f, 0.75f, 0.50f, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 void stShutDown ( ESContext *esContext ) | 244 void stShutDown ( ESContext *esContext ) |
| 244 { | 245 { |
| 245 STUserData *userData = esContext->userData; | 246 STUserData *userData = esContext->userData; |
| 246 | 247 |
| 247 // Delete program object | 248 // Delete program object |
| 248 glDeleteProgram ( userData->programObject ); | 249 glDeleteProgram ( userData->programObject ); |
| 249 | 250 |
| 250 // Delete vertex buffer objects | 251 // Delete vertex buffer objects |
| 251 glDeleteBuffers ( 2, userData->vboIds ); | 252 glDeleteBuffers ( 2, userData->vboIds ); |
| 252 } | 253 } |
| OLD | NEW |