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

Unified Diff: third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.c

Issue 552012: Added texture wrap demo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h ('k') | third_party/gles2_book/gles2_book.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.c
===================================================================
--- third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.c (revision 36357)
+++ third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.c (working copy)
@@ -14,31 +14,8 @@
// wrap modes available on 2D textures
//
#include <stdlib.h>
-#include "esUtil.h"
+#include "TextureWrap.h"
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
- GLint texCoordLoc;
-
- // Sampler location
- GLint samplerLoc;
-
- // Offset location
- GLint offsetLoc;
-
- // Texture handle
- GLuint textureId;
-
- // Vertex buffer object handle
- GLuint vboIds[2];
-
-} UserData;
-
///
// Generate an RGB8 checkerboard image
//
@@ -113,9 +90,9 @@
///
// Initialize the shader and program object
//
-int Init ( ESContext *esContext )
+int twInit ( ESContext *esContext )
{
- UserData *userData = esContext->userData;
+ TWUserData *userData = esContext->userData;
GLbyte vShaderStr[] =
"uniform float u_offset; \n"
"attribute vec4 a_position; \n"
@@ -183,9 +160,9 @@
#define VTX_POS_SIZE 4
#define VTX_TEX_SIZE 2
#define VTX_STRIDE (6 * sizeof(GLfloat))
-void Draw ( ESContext *esContext )
+void twDraw ( ESContext *esContext )
{
- UserData *userData = esContext->userData;
+ TWUserData *userData = esContext->userData;
GLuint offset = 0;
// Set the viewport
@@ -232,16 +209,14 @@
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT );
glUniform1f ( userData->offsetLoc, 0.7f );
glDrawElements ( GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0 );
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
}
///
// Cleanup
//
-void ShutDown ( ESContext *esContext )
+void twShutDown ( ESContext *esContext )
{
- UserData *userData = esContext->userData;
+ TWUserData *userData = esContext->userData;
// Delete texture object
glDeleteTextures ( 1, &userData->textureId );
@@ -252,24 +227,3 @@
// Delete vertex buffer objects
glDeleteBuffers ( 2, userData->vboIds );
}
-
-
-int main ( int argc, char *argv[] )
-{
- ESContext esContext;
- UserData userData;
-
- esInitContext ( &esContext );
- esContext.userData = &userData;
-
- esCreateWindow ( &esContext, "MipMap 2D", 640, 480, ES_WINDOW_RGB );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
« no previous file with comments | « third_party/gles2_book/Chapter_9/TextureWrap/TextureWrap.h ('k') | third_party/gles2_book/gles2_book.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698