GLOVE is accompanied by a demo SDK that contains fully commented, highly optimized C applications (accompanied by the ESSL shader source code). These demos demonstrate some simple rendering techniques with different geometry complexities, as they were designed with the restrictions of low-power embedded platforms in mind (see Table 1 ).
Name | Dimension | Shading Functionality |
---|---|---|
triangle2d_one_color | 2D | Draw a single 2D triangle with white color |
triangle2d_split_colors | 2D | A 2D triangle is rendered on the screen. The color of each non-empty pixel is dynamically chosen at runtime between 2 fixed colors (red & green) based on its screen-space position. |
circle2d_sdf | 2D | A dynamically generated circle is drawn (with time-varying radius) using signed distance fields. Note that no geometry (for the 2D circle) is streamed to hardware. |
texture2d_color | 2D | A fullscreen quad rendering (using two triangles) is used to draw a 2D texture. |
cube3d_vertexcolors | 3D | Draw a 3D rotated (in Y axis) cube in the center of the screen with per-vertex colors. Note that this example also supports transparency via blending operations and orthographic camera projection (default: perspective). |
cube3d_textures | 3D | Similar graphics rendering framework as ' cube3d_vertexcolors ' but with different shading method: Mixing two textures. |
render_to_texture_filter_gamma | 2D/3D | 2D image processing effects on a texture generated by off-screen rendering a 3D rotated cube (using demo example 'cube3d_texture '). To achieve this, we initially render scene to a Frame Buffer Object (FBO) and then perform post-processing Gamma correction filtering on the generated texture. |
render_to_texture_filter_invert | 2D/3D | Similar graphics rendering framework as ' render_to_texture_filter_gamma ' but with different filtering effect: Color Invert |
render_to_texture_filter_grayscale | 2D/3D | Similar graphics rendering framework as ' render_to_texture_filter_gamma ' but with different filtering effect: Grayscale |
render_to_texture_filter_sobel | 2D/3D | Similar graphics rendering framework as ' render_to_texture_filter_gamma ' but with different filtering effect: Sobel |
render_to_texture_filter_boxblur | 2D/3D | Similar graphics rendering framework as ' render_to_texture_filter_gamma ' but with different filtering effect: Box Blur |
Table 1. Example demos name and description
Open a new terminal and navigate to the ' build/Demos/demos' directory ($ cd build/Demos/demos/
), then run all examples by typing this command:
$ ./run_all_samples.sh
Note that file logging of OpenGL debug and Vulkan profile is supported (use --help for details).
A number of object-like and conditional macros have been used to offer debug and profiling features as well as to simplify the setting process of the demo configuration (see Table 2 ).
Name | Values | Functionality |
---|---|---|
DEBUG | (a)DEBUG_OPENGLES (b)DEBUG_ASSET_MANAGEMENT | Enable to log errors for (a) OpenGL ES API and (b) asset management respectively. |
PROFILE | (a)FPS_DISPLAY, FPS_TIME_PERIOD = X (b)INFO_DISPLAY | Enable to report (a) processed time in fps and ms for the time period of X seconds and (b) shading and rendering settings respectively. |
CONFIG | KILL_APP = Y | Enable to auto terminate the application after the time period of Y seconds (suggestion: Y>X). |
BINARY_PROG | DBINARY_PROG | Enable to load from a precompiled shader program. Disable to load from vertex and fragment shaders. |
WINDOW_SIZE | WIDTH = W, HEIGHT = H | Set the dimensions of the application window to be [W,H]. Note that this macro definition is mandatory. |
Table 2. Makefile macros used by our demos.
A list of key bindings are provided for information and testing purposes (see Table 3 ). Note that the keys 't' and 'p' are available only for the 'cube3d_vertexcolors' and 'cube3d_textures' demos that handles 3d shapes.
Key | Functionality | Mode |
---|---|---|
Esc | Exit the application | - |
t | Changes the material type of all objects | Opaque/Transparent |
p | Changes the projection transformation of the camera | Perspective/Orthographic |
Table 3. Key bindings for the provided demos.
Vulkan logo texture has been downloaded from the Khronos Official Logo Archive and is registered trademarks of the Khronos Group Inc.
An offline compiler interface of input (vertex and fragment) shader sources is also provided ensuring that the resulting shader program binary can be efficiently loaded into the graphics application. This is a very useful path for applications that wish to remain portable by shipping pure ESSL source shaders, yet would like to avoid the cost of compiling their shaders at runtime. The tool, which can be found in the ' build/Demos/tools' folder ($ cd build/Demos/tools/
), works by compiling and linking the given shaders and returns back the final program binary through a command-line interface. If the vertex and fragment ESSL source shader names are 'sh.vert' and 'sh.frag' respectively, then the generated precompiled binary shader program, named 'sh.bin', can be generated by executed this command:
$ ./offline_shader_compiler -v sh.vert -f sh.frag -o sh.bin
Note that, the BINARY_PROG macro preprocessor in the ' CMakeLists.txt' file has to be provided in the CMAKE_C_FLAGS to inform graphics applications to use precompiled shaders (see Table 2).
Currently, GLOVE uses the es2gears demo (official link here) as a demo application for Android.
The installation procedure requires a device that supports Vulkan. Ensure that the device is connected to the building machine, open a new terminal and type the following command:
$ adb install android/bin/NativeActivity-debug.apk
The application will be automatically installed to the Android device.
To execute the application, tap on the application icon named 'GLOVE_Demo'.