📜 ⬆️ ⬇️

Working with graphic objects in Android


By clicking the "Next" button, you will find a translation of four small educational materials on various techniques of processing and generating images in Android; three of them have the source code of test programs and reference material for it. In our opinion, these manuals can be useful to everyone who develops applications and games for Android.
Under the cat are the following articles:

Sample Clustered Shading on Android

In this example, several techniques for shading scenes containing multiple light sources are implemented and compared for Android. The full source code is available on GitHub , it can also be downloaded via a direct link . The most effective method shown in the example is clustering shading described in this document . This example is a more advanced version for Windows ported to Android, available for download from here .
The example uses the following methods:

In our example, the following image is generated:



In the examples folder there are two solutions for Visual Studio:

If you do not want to install Visual GDB, follow the instructions listed in the readme.txt file in the examples folder to build it manually.
Original article.
')

Acquaintance with RenderScript. Tutorial

The RenderScript for Android study guide covers the basics of using RenderScript in the development of an application for Android 4.2.2 and higher.
The manual focuses on RenderScript, its core language, and the Java API. Since the tutorial uses only Java, although there are native C / C ++ analogues for the RenderScript API, and since RenderScript uses the Dynamic Compilation Method (JIT), the resulting compiled application can be run on any device with the correct version of Android.
The learning application has a minimalistic graphical interface that displays the results of calculations and statistics. It implements a simple algorithm for processing a full-screen image with which you can interact with the help of touches.
Target platform: Emulators and devices with Android 4.2.2 and higher
Development Platform: Any
Difficulty Level: Beginner



For more information on the example, refer to the user guide located inside the test archive.
Download source code / documentation .
Original article

Meet OpenCL for Android. Tutorial

The OpenCL tutorial for Android introduces the basic principles of using OpenCL in Android applications. Educational application is a tool for interactive image processing.
The focus of the manual is on how to use OpenCL in an Android application, where to start writing OpenCL code and linking to OpenCL runtime. The manual demonstrates the typical sequence of calls to the OpenCL API and the usual course of action for creating a simple image handler with animation for an OpenCL device. More advanced topics such as efficient data sharing or OpenCL for Android performance issues are not covered in this tutorial.
Difficulty Level: Beginner
Development Platform: Any
Target platform: Devices with Android 4.2.2 and higher
Target device: GPU device on Android device
Comment. The Android emulator does not support the GPU OpenCL device. To run the sample code on the emulator, change the target GPU device on the CPU by replacing CL_DEVICE_TYPE_GPU with CL_DEVICE_TYPE_CPU in line 451 of the jni / step.cpp file.



For more information on the example, refer to the user guide located inside the test archive.
Download source code / documentation .
Original article

Tessellation for OpenGL ES 3.1 on Android

This article discusses how to implement and use tessellation in OpenGL ES 3 on Android. Tessellation is a hardware tool that allows the graphics processor (GPU) to dynamically subdivide primitives. It also allows you to manage the placement of new vertices.
The usual use of tessellation - dynamic scaling of the level of detail of the terrain, depending on the distance from the camera. Thus, high definition of a tightly triangulated territory is combined with good performance.
To support this technique, tessellation shaders are currently added in DirectX 11 and OpenGL 4.0. OpenGL ES does not yet have tessellation shaders, but the Intel Bay Trail platform has an extension that allows the use of tessellation in OpenGL ES 3.0.
The following steps show how the GPU uses tessellation to dynamically scale the terrain. The original terrain consists of a low-resolution grid and a high-resolution height map texture.
  1. The tessellation control shader calculates the distance between the current triangle and the camera and sets the tessellation level depending on the calculated value. The closer the camera is to the triangle, the higher the tessellation level.
  2. The tessellation calculation shader adds new vertices to the triangles and moves them up or down depending on the values ​​of the high resolution height map.

As a result, the tessellation triangles close to the camera refine the height map with more subtle details and add small depressions and bulges where the camera can see them.


Tessellation is turned off


Tessellation is enabled

OpenGL ES Tessellation
Original article.

Source: https://habr.com/ru/post/233889/


All Articles