You copied the Doc URL to your clipboard.

1.1.1. Sample applications

The following Android NDK sample applications can be used on Android.

AntiAlias

This shows how to select anti-aliasing levels and the effect of different levels of anti-aliasing.:

  • a shader renders a simple triangle

  • some text is written to the screen

  • the FPS count is output on the terminal window.

Note

  • With only approximately 2% performance drop, 4x anti-aliasing is nearly free on Mali hardware and is adequate for most applications.

  • Significantly higher quality results from 16x anti-aliasing, but it has over 50% drop in performance.

  • Because of the benefit with almost no cost, ARM recommends using 4x anti-aliasing rather than the default of no anti-aliasing.

Cube

This displays a spinning cube on the screen.

The sample uses matrix functions, renders fonts, and writes the FPS value to the terminal.

EGLPreserve

This shows the change in behavior of eglSwapBuffers is caused by changing the EGL_SWAP_BEHAVIOR attribute to EGL_BUFFER_PRESERVED.

ETCAtlasAlpha

This uses an alpha channel that was converted to a visible greyscale image. The alpha image is concatenated onto the original texture.

ETCCompressedAlpha

This uses an alpha channel that is delivered as a second packed texture.

ETCUncompressedAlpha

This uses an alpha channel that is provided as a raw 8-bit single channel image. Uncompressed alpha takes up more space than compressed alpha, but is more flexible and enables alpha and color information to be mixed.

ETCMipmap

This shows how to load and display ETC format textures with Mipmaps.

FrameBufferObject

This shows the render-to-texture feature of OpenGL ES 2.0. A colored spinning cube is rendered to a frame buffer, which is then attached as a texture on the faces of another spinning cube.

ListEGLConfigs

This shows:

  • how to list the available EGLConfig

  • how to select the correct EGLConfig to create a surface.

Triangle

This shows how to draw a simple colored triangle on the screen using a programmable shader.

Rotozoom

This shows how to implement a classic demo effect by rotating and zooming a texture. It shows how to increase the speed of the effect by moving the work from the fragment shader to the vertex shader and CPU.

Template

This is an empty template that you can use to start developing a new application. The code is structured to contain everything that is required to compile and run, but nothing is rendered.

The following Android SDK Java applications can be used on Android.

RenderToTexture

This is similar to the FrameBufferObject NDK sample application, except this sample application is written in Java.

SpinningCube

This displays a spinning cube on the screen.

The textures are rendered by Java code.

Template

This is an empty Java template that you can use to start developing a new application. The code is structured to contain everything that is required to compile and run, but nothing is rendered.

Note

More information on the sample applications might be provided in the \docs folder for that sample.

Was this page helpful? Yes No