Join GitHub today
Sample Android app demonstrating OpenGL-ES 2.0 shader programs
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
GLES 2.0 Sample is a sample Android application that does 3D animation using OpenGL-ES 2.0 (available with Android 2.2 and later). The 2.0 version of OpenGL-ES throws away the traditional OpenGL fixed-function pipeline (built-in transformation matrix, lighting and materials functions) in favour of shader programs that you must completely specify yourself. Google's Java sample code that comes with the Android SDK includes only the most trivial example of how to write such shaders; hopefully this sample will be a slightly more interesting one to learn from and build on. The source code includes the following Java utility classes: * BaseRenderer: simplifies some aspects of implementing a GLSurfaceView.Renderer class. * BundledSavedState: generic class for easier implementation of save/restore instance state in a custom View * GeomBuilder: basic management of 3D object geometry with choice of wireframe or shaded rendering, allowing customization of the vertex shader program to implement materials, lighting etc * GLUseful: useful OpenGL-related stuff, including error-checking and management of shader programs * GLTextureView: displays a texture on a planar rectangle in OpenGL * GLBitmapView: takes an image rendered via a Canvas to an offscreen Bitmap and displays it as a texture via GLTextureView * Lathe: uses GeomBuilder to construct objects with rotational symmetry * Mat4f: functional operations on matrices representing 3D homogeneous coordinates * PaintBuilder: convenient construction of Paint objects by chaining setup calls * Rotation: manipulation of rotation transformations based on quaternions * Vec3f: functional operations on vectors representing 3D coordinates and the following C utility code: * gl_useful.c -- contains an alternative to glGetShaderInfoLog which actually works. When the animation is running, tap the view to bring up a dialog that allows a choice between shaded and wireframe rendering modes. Contents: README -- this file INSTALL -- build/installation instructions jni/ -- C sources for the Android app src/ -- Java sources for the Android app, split into src/lib/ -- reusable classes as listed above src/app/ -- classes specific to this example app res/ -- resources for the Android app AndroidManifest.xml, build.xml, *.properties -- for driving Google's Android build tools (note that you will have to provide a couple more of these--see INSTALL for details) LICENSE -- licence (Apache 2.0, same as Google's sample code) Lawrence D'Oliveiro <email@example.com>