Reprint please indicate the source
This article is from Hansion's blog
OpenGL ES (OpenGL for Embedded Systems)
is a subset of OpenGL's three-dimensional graphics API, designed for embedded devices such as mobile phones, PDAs and game consoles, and is used primarily for the development of 3D graphics applications
Android supports the following versions of the OpenGL ES API:
OpenGL ES 1.0 and 1.1 support Android 1.0 and later
OpenGL ES 2.0 supports Android 2.2 (API Level 8) and later
OpenGL ES 3.0 supports Android 4.3 (API level 18) and later
OpenGL ES 3.1 supports Android 5.1 (API level 21) and later
Be careful not to mix OpenGL ES 1.x API calls with the OpenGL ES 2.0 method because their APIs are not interchangeable.
There are two base classes in the Android framework: Glsurfaceview and Glsurfaceview.renderer, which allow you to create and manipulate graphics using the OpenGL ES API. Glsurfaceview:
is a view that can be used to draw and manipulate objects using OpenGL API calls, functionally similar to Surfaceview.
You can use it by creating an instance of Glsurfaceview and adding a renderer.
Glsurfaceview.renderer:
This interface defines the methods required to draw a graphic in Glsurfaceview.
You must provide a separate class to implement this interface, and attach it to the Glsurfaceview instance using Glsurfaceview.setrenderer ().
It must implement the following methods:
Onsurfacecreated (): The method is called once when the Glsurfaceview is created. We do this in this method with just one operation, such as setting OpenGL environment parameters or initializing OpenGL graphics objects.
Ondrawframe (): This method is called each time the system redraws glsurfaceview. This method is used to draw (and redraw) drawing objects.
Onsurfacechanged (): This method is called by the system when the size of the Glsurfaceview or the device screen orientation is changed. For example, the system calls this method when the device changes from portrait to landscape.
OpenGL on Android is implemented by Vertex Shader (fixed-point shader) and Fragment Shader (fragment shader) for both fixed-point shader programs to load and render images.
The purpose of the vertex shader is to generate coordinates for each vertex, so each vertex runs through the vertex shader program once, and once the vertex coordinates are computed, OpenGL can use the vertices to form points, lines, and triangles. All graphics are described by these three basic elements.
The fragment shader 's purpose is to generate the final rendered color for the fragment (Fragment) of each vertex of a point, line, or triangle. A fragment is a small, monochrome rectangular area that you can simply think of as a pixel on the screen.
OpenGL coordinates origin in the center of the screen, the left and right coordinate range is [ -1,1].
Reference:
OpenGL ES Official information
Android OpenGL ES Primer Series (i)---Learn about OpenGL ES's past life