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

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

Issue 549063: Added cubemap 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
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 );
-}

Powered by Google App Engine
This is Rietveld 408576698