Mali™ GPU User Interface Engine Application Development Guide

Version: 2.3.1

Table of Contents

About this book
Intended audience
Using this book
Typographical Conventions
Additional reading
Feedback on this product
Feedback on content
1. Introduction
1.1. About the Mali GPU User Interface Engine
1.1.1. Development environment
1.1.2. Class hierarchy
2. Tutorial on the System Classes
2.1. About the System components
2.2. Creating a simple application with just the System and Keyboard classes
2.3. Creating an OpenGL ES rendering context
2.4. Creating a filesystem interface
2.5. Creating a Timer interface
3. Tutorial on Drawing 2D Shapes
3.1. Drawing a triangle
3.2. Vertex coloring
3.2.1. Per-vertex coloring with 8-bit color values
3.2.2. Per-vertex coloring with floating-point color values
3.2.3. Combining the position coordinates and color values into a single array
3.3. Drawing a rectangle with a custom texture
4. Tutorial on Drawing 3D Shapes
4.1. Drawing a simple 3D cube
4.2. Coloring the cube faces
4.3. Texturing the cube faces
4.3.1. Converting the vertexBuffer and drawArrays to draw triangles
4.3.2. Drawing individual triangles from the cube shape
4.4. Controlling lighting effects
4.4.1. Replacing the teapot with a cube
4.4.2. Drawing both the teapot and the cube
4.5. Bump mapping on the cube
4.6. Cube mapping
4.7. Advanced MBA scene rendering
4.8. Lightshow animation with moving sprite and camera
5. Tutorial on the Lotion User Interface Classes
5.1. Overview of the Lotion source code
5.1.1. Directory organization
5.1.2. Overview of initialization in main.cpp
5.1.3. Interaction between the Lotion classes
5.2. The lotion main.cpp file
5.2.1. Includes and enumerations in main.cpp
5.2.2. Convenience functions
5.2.3. Evaluating the start-up arguments
5.2.4. Initializing the applets
5.2.5. Starting the application
5.3. The application.cpp file
5.4. Modifications to lightshow.cpp
5.4.1. New lightshow.h file
5.4.2. Modified startup code in lightshow.cpp
5.4.3. Changes to traverseDraw()
5.4.4. Utility functions for lighting
5.4.5. Widget initialization and event handling
5.4.6. Modified draw loop
5.5. The Theme class and blue.cpp
5.5.1. Theme namespace and includes
5.5.2. Theme onCreate() method
5.5.3. Theme update methods
5.5.4. Handling user interface events in the Theme class
5.5.5. Theme addApplet() method
5.5.6. Theme createWidgetGroup() method
5.5.7. Theme runApplet() and closeApplet() methods
5.5.8. Theme draw() method
5.6. Running the lotion application
6. Tutorial on Constructing Custom Shaders
6.1. Overview of the graphics pipeline
6.2. Data resources used by the shaders
6.3. Passing data as uniforms
6.3.1. Vertex buffer objects
6.3.2. Using asset files
6.3.3. Locations and view transformations as vectors and matrices
6.3.4. Textures
6.4. Minimal shader programs
6.4.1. Adding vertex coloring
6.5. Assigning the shader programs
6.5.1. In-line source code
6.5.2. External shader source code
6.5.3. Precompiled shader programs
6.6. Filling a shape with a bitmap texture
6.7. Performing matrix transformations in the shaders
6.7.1. Example of a simple world-view transformation
6.7.2. Example showing calculation of specular reflections
6.7.3. Example showing calculation of bump-mapped reflections
A. Matrix and Vector Operations
A.1. Matrix and vector functions in the MDE library

List of Figures

1.1. Mali GPU Development Tools work flow
1.2. Asset classes
1.3. Loader classes
1.4. Loader classes
2.1. System window showing exception trapping
2.2. Blank graphics context
3.1. The 2D red triangle
3.2. The 2D triangle with per-vertex coloring
3.3. The 2D triangle with per-vertex coloring and floating-point color values
3.4. The 2D triangle with combined position and color values in one vertexBuffer array
3.5. A custom texture on a 2D shape
4.1. The Hello World shape
4.2. The Hello World shape with vertex coloring
4.3. The cube shape with texturing
4.4. The cube shape with half of the triangles removed
4.5. The teapot shape with lighting effects
4.6. The lighting example with a cube shape instead of the teapot
4.7. The lighting example with a cube and teapot
4.8. The lighting example with a cube and teapot vertically offset
4.9. Contents of rock texture and normal files
4.10. The cube shape with bump-mapped shading
4.11. Ambient light only
4.12. Diffuse light only
4.13. Specular light only
4.14. Red specular light
4.15. Environment bitmap 1.png
4.16. Environment bitmap 2.png
4.17. Environment bitmap 3.png
4.18. Environment bitmap 4.png
4.19. Environment bitmap opp.png
4.20. Environment bitmap ned.png
4.21. The mirrored teapot shape with cube mapping for the environment
4.22. The advanced mba shape with tree traversal
4.23. The Lighting image with moving camera and object
5.1. Lotion main.cpp execution flow
5.2. Application run() method
5.3. Startup and creation of applets
5.4. Control flow between the lotion application and the lightshow applet
5.5. Lotion startup messages
5.6. lotion window
5.7. lotion window
5.8. Lightshow applet in normal mode
5.9. Lightshow applet running in OpenGL ES 1.1 mode
5.10. Lightshow applet running in wireframe mode
6.1. Processing flow with GPU shaders
6.2. Simplified view of shader data flow

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM in the EU and other countries, except as otherwise stated below in this proprietary notice. Other brands and names mentioned herein may be the trademarks of their respective owners.

Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This document is intended only to assist the reader in the use of the product. ARM shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.

Where the term ARM is used it means “ARM or any of its subsidiaries as appropriate”.

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.

Product Status

The information in this document is for a Beta product, that is a product under development.

Revision History
Revision A02a30 June 2010First version of document. Beta release.
Copyright © 2010 ARM. All rights reserved.ARM DUI 0527A‑02a
Non-Confidential - Draft - BetaID070710