Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(953)

Side by Side Diff: third_party/gles2_book/Chapter_8/Simple_VertexShader/Simple_VertexShader.c

Issue 2134006: Added EGL based GLContext.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698