Index: third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c |
=================================================================== |
--- third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c (revision 36268) |
+++ third_party/gles2_book/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c (working copy) |
@@ -13,28 +13,8 @@ |
// This is a simple example that draws a sphere with a cubemap image applied. |
// |
#include <stdlib.h> |
-#include "esUtil.h" |
+#include "Simple_TextureCubemap.h" |
-typedef struct |
-{ |
- // Handle to a program object |
- GLuint programObject; |
- |
- // Attribute locations |
- GLint positionLoc; |
- GLint normalLoc; |
- |
- // Sampler location |
- GLint samplerLoc; |
- |
- // Texture handle |
- GLuint textureId; |
- |
- // Vertex data |
- int numIndices; |
- GLuint vboIds[3]; |
-} UserData; |
- |
/// |
// Create a simple cubemap with a 1x1 face with a different |
// color for each face |
@@ -100,9 +80,9 @@ |
/// |
// Initialize the shader and program object |
// |
-int Init ( ESContext *esContext ) |
+int stcInit ( ESContext *esContext ) |
{ |
- UserData *userData = esContext->userData; |
+ STCUserData *userData = esContext->userData; |
int numSlices = 20; |
int numVertices = ( (numSlices / 2) + 1 ) * ( numSlices + 1 ); |
GLfloat *vertices = NULL; |
@@ -167,9 +147,9 @@ |
/// |
// Draw a triangle using the shader pair created in Init() |
// |
-void Draw ( ESContext *esContext ) |
+void stcDraw ( ESContext *esContext ) |
{ |
- UserData *userData = esContext->userData; |
+ STCUserData *userData = esContext->userData; |
// Set the viewport |
glViewport ( 0, 0, esContext->width, esContext->height ); |
@@ -203,16 +183,14 @@ |
glDrawElements ( GL_TRIANGLES, userData->numIndices, |
GL_UNSIGNED_SHORT, 0 ); |
- |
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface ); |
} |
/// |
// Cleanup |
// |
-void ShutDown ( ESContext *esContext ) |
+void stcShutDown ( ESContext *esContext ) |
{ |
- UserData *userData = esContext->userData; |
+ STCUserData *userData = esContext->userData; |
// Delete texture object |
glDeleteTextures ( 1, &userData->textureId ); |
@@ -223,24 +201,3 @@ |
// Delete vertex buffer objects |
glDeleteBuffers ( 3, userData->vboIds ); |
} |
- |
- |
-int main ( int argc, char *argv[] ) |
-{ |
- ESContext esContext; |
- UserData userData; |
- |
- esInitContext ( &esContext ); |
- esContext.userData = &userData; |
- |
- esCreateWindow ( &esContext, "Simple Texture Cubemap", 320, 240, ES_WINDOW_RGB ); |
- |
- if ( !Init ( &esContext ) ) |
- return 0; |
- |
- esRegisterDrawFunc ( &esContext, Draw ); |
- |
- esMainLoop ( &esContext ); |
- |
- ShutDown ( &esContext ); |
-} |