• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1This sample demonstrates how to use OpenGL ES 3.0 from JNI/native code.
2
3The sample can be built two different ways:
4  * Compatible with API level 11 and later [*1]
5  * Require API level 18 or later.
6Both versions include an OpenGL ES 2.0 fallback path for devices that don't
7support OpenGL ES 3.0.
8
9To build and install the sample:
10$ ln -s AndroidManifest-$N.xml AndroidManifest.xml
11$ ln -s Android-$N.mk jni/Android.mk
12$ $ANDROID_SDK/tools/android update project --path . --target android-$N
13$ ../../ndk-build
14$ ant debug
15$ adb install bin/GLES3JNIActivity-debug.apk
16where $N is '11' or '18' and
17ANDROID_SDK is the root of your SDK installation.
18
19The OpenGL ES 3.0 rendering path uses a few new features compared to the
20OpenGL ES 2.0 path:
21
22* Instanced rendering and vertex attribute divisor to reduce the number of
23  draw calls and uniform changes.
24* Vertex array objects to reduce the number of calls required to set up
25  vertex attribute state on each frame.
26* Explicit assignment of attribute locations, eliminating the need to query
27  assignments.
28
29
30[*1] The only dependency on API level 11 is the call to
31     setEGLContextClientVersion in GLES3JNIView. With a custom
32     EGLConfigChooser and EGLContextFactory the sample would be compatible
33     with older API levels.
34