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

Unified Diff: third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c

Issue 545092: Added stencil-test 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_11/Stencil_Test/Stencil_Test.c
===================================================================
--- third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c (revision 36394)
+++ third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.c (working copy)
@@ -14,30 +14,14 @@
// operations.
//
#include <stdlib.h>
-#include "esUtil.h"
+#include "Stencil_Test.h"
-typedef struct
-{
- // Handle to a program object
- GLuint programObject;
-
- // Attribute locations
- GLint positionLoc;
-
- // Uniform locations
- GLint colorLoc;
-
- // Vertex buffer object handles
- GLuint vboIds[2];
-
-} UserData;
-
///
// Initialize the shader and program object
//
-int Init ( ESContext *esContext )
+int stInit ( ESContext *esContext )
{
- UserData *userData = esContext->userData;
+ STUserData *userData = esContext->userData;
GLbyte vShaderStr[] =
"attribute vec4 a_position; \n"
"void main() \n"
@@ -122,12 +106,12 @@
// Initialize the stencil buffer values, and then use those
// values to control rendering
//
-void Draw ( ESContext *esContext )
+void stDraw ( ESContext *esContext )
{
int i;
GLubyte *offset = NULL;
- UserData *userData = esContext->userData;
+ STUserData *userData = esContext->userData;
#define NumTests 4
GLfloat colors[NumTests][4] = {
@@ -251,16 +235,14 @@
glUniform4fv( userData->colorLoc, 1, colors[i] );
glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, offset );
}
-
- eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface );
}
///
// Cleanup
//
-void ShutDown ( ESContext *esContext )
+void stShutDown ( ESContext *esContext )
{
- UserData *userData = esContext->userData;
+ STUserData *userData = esContext->userData;
// Delete program object
glDeleteProgram ( userData->programObject );
@@ -268,25 +250,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, "Stencil Test", 320, 240,
- ES_WINDOW_RGB | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL );
-
- if ( !Init ( &esContext ) )
- return 0;
-
- esRegisterDrawFunc ( &esContext, Draw );
-
- esMainLoop ( &esContext );
-
- ShutDown ( &esContext );
-}
« no previous file with comments | « third_party/gles2_book/Chapter_11/Stencil_Test/Stencil_Test.h ('k') | third_party/gles2_book/gles2_book.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698