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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Get the uniform locations | 52 // Get the uniform locations |
53 userData->mvpLoc = glGetUniformLocation( userData->programObject, "u_mvpMatri
x" ); | 53 userData->mvpLoc = glGetUniformLocation( userData->programObject, "u_mvpMatri
x" ); |
54 | 54 |
55 // Generate the vertex data | 55 // Generate the vertex data |
56 userData->numIndices = esGenCube( 1.0, &vertices, NULL, NULL, &indices ); | 56 userData->numIndices = esGenCube( 1.0, &vertices, NULL, NULL, &indices ); |
57 glGenBuffers ( 2, userData->vboIds ); | 57 glGenBuffers ( 2, userData->vboIds ); |
58 glBindBuffer ( GL_ARRAY_BUFFER, userData->vboIds[0] ); | 58 glBindBuffer ( GL_ARRAY_BUFFER, userData->vboIds[0] ); |
59 glBufferData ( GL_ARRAY_BUFFER, 3 * numVertices * sizeof(GLfloat), | 59 glBufferData ( GL_ARRAY_BUFFER, 3 * numVertices * sizeof(GLfloat), |
60 vertices, GL_STATIC_DRAW ); | 60 vertices, GL_STATIC_DRAW ); |
61 glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER, userData->vboIds[1] ); | 61 glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER, userData->vboIds[1] ); |
62 glBufferData ( GL_ELEMENT_ARRAY_BUFFER, userData->numIndices * sizeof(GL_UNSI
GNED_SHORT), | 62 glBufferData ( GL_ELEMENT_ARRAY_BUFFER, userData->numIndices * sizeof(GLushor
t), |
63 indices, GL_STATIC_DRAW ); | 63 indices, GL_STATIC_DRAW ); |
64 if ( vertices != NULL ) free ( vertices ); | 64 if ( vertices != NULL ) free ( vertices ); |
65 if ( indices != NULL ) free ( indices ); | 65 if ( indices != NULL ) free ( indices ); |
66 | 66 |
67 // Starting rotation angle for the cube | 67 // Starting rotation angle for the cube |
68 userData->angle = 45.0f; | 68 userData->angle = 45.0f; |
69 | 69 |
70 glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ); | 70 glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ); |
71 return TRUE; | 71 return TRUE; |
72 } | 72 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void svsShutDown ( ESContext *esContext ) | 141 void svsShutDown ( ESContext *esContext ) |
142 { | 142 { |
143 SVSUserData *userData = esContext->userData; | 143 SVSUserData *userData = esContext->userData; |
144 | 144 |
145 // Delete program object | 145 // Delete program object |
146 glDeleteBuffers ( 2, userData->vboIds ); | 146 glDeleteBuffers ( 2, userData->vboIds ); |
147 | 147 |
148 // Delete program object | 148 // Delete program object |
149 glDeleteProgram ( userData->programObject ); | 149 glDeleteProgram ( userData->programObject ); |
150 } | 150 } |
OLD | NEW |