What is the OpenGL

OpenGL is a cross-platform software interface language used to call 2D and 3D graphics processors of hardware.

Since it is only a software interface, the specific underlying implementation depends on the hardware device manufacturer.

Android includes support for high performance 2D and 3D graphics with the Open Graphics Library (OpenGL®), specifically, the OpenGL ES API. OpenGL is a cross-platform graphics API that specifies a standard software interface for 3D graphics processing hardware. OpenGL ES is a flavor of the OpenGL specification intended for embedded devices.

What is OpenGL ES

OpenGL ES is a branch of OpenGL. It cuts some unnecessary functions of OpenGL for embedded devices. Unless otherwise specified later in this blog series, OpenGL means OpenGL ES.

Application scenarios

  • The game
  • Video player, editing applications
  • Camera, image processing applications
  • The application of high requirement on timeliness of image processing

Android support for OpenGL

OpenGL ES version OpenGL based version The version introduced on Android compatibility Functions and features
1.0 & 1.1 1.3 & 1.5 The Android 1.0 Fixed image pipeline, lower development difficulty compared to 2.0
2.0 2.0 Android 2.2 (API level 8) Incompatible 1. X The programmable rendering pipeline is more efficient and difficult to develop
3.0 3.x Android 4.3 (API level 18) Compatible with 2.0 Higher performance, support ETC2 format transparent texture compression
3.1 4.x Android 5.0 (API level 21) Compatible with 2.0/3.0 Add compute shaders, separate shader objects and other new features, see moreAndroid5.0 features

Learned version

Choose version 2.0, because even if the user’s phone is Android 4.3 or higher, the device manufacturer does not necessarily implement the 3.0API interface. The following figure shows the official OpenGL version support.




Official statistics on OpenGL version support

Version Support Statement

After adding the following feature declaration to androidmanifest.xml, Google Play will filter out users who do not support OpenGL ES 2.0 and refuse to install it.

<uses-feature android:glEsVersion="0x00020000" android:required="true" />
Copy the code

Values corresponding to different versions

version GlEsVersion value
2.0 0x00020000
3.0 0x00030000
3.1 0x00030001

The development way

  • OpenGL is called through the Java interface implemented by Android
  • C language to write OpenGL code, and then through JNI call (cross-platform development can be considered)

reference

See the Android OpenGL ES learning materials list of blogs, information.

GitHub code Engineering

Please refer to my GitHub project GLStudio for all relevant code for this series of courses.

The course catalog

Android OpenGL ES tutorials are available in the Android OpenGL ES tutorial