Android OpenGL details 2

Source: Internet
Author: User

OpenGL version and device compatibility
OpenGLES 1.0 and 1.1API specifications have been supported since Android1.0. since Android2.2 (API Level 8), the Framework supports OpenGLES 2.0 API specifications. openGLES 2.0 is supported by most Android devices and is recommended for use in new OpenGL-based applications.

Support for texture Compression
Texture compression significantly improves the performance of OpenGL applications by reducing memory usage. the Android framework supports the ETC1 compression format as a standard feature, including an ETC1Util tool class and the compression tool etc1tool (location in AndroidSDK: <sdk>/tools /). for the example of using texture compression, see the sample code: CompressedTextureActivity.

 

 

Check whether ETC1 format is supported on a device. Call ETC1Util. isETC1Supported.

 

 

Note: The ETC1 format does not support textures with alpha channels. If your application requires textures with alpha channels, you need to investigate other texture compression formats supported by your device.

 

 

In addition to the ETC1 format, Android devices also support other texture compression formats. The specific format is related to the GPU chip and OpenGL implementation. you should check the texture compression formats supported on the target device to determine the format used by your application. to determine which compression format is used on the device, you must query the device and check the OpenGL extension name. The extension name identifies the texture compression formats supported by the device (and other OpenGL features ). some frequently supported texture compression formats are listed below:

ATITC (ATC)-ATI texture compression (ATITCor ATC) is widely supported by devices. It supports RGB texture compression with Fixed Frame rates, and supports RGB textures with or without alpha channels. this format may be represented by multiple OpenGL extension names, for example:

GL_AMD_compressed_ATC_texture

GL_ATI_texture_compression_atitc

PVRTC-PowerVR texture compression texturecompression (PVRTC) is also widely supported by devices. It supports 2-bit and 4-bit pixel textures with or without alpha channels. this format is represented by the following OpenGL extension name:

GL_IMG_texture_compression_pvrtc

S3TC (DXTn/DXTC)-S3 texture compression (S3TC) has many variant formats (DXT1 to DXT5) and is not widely supported. it supports 4-bit or 8-bit RGB textures with alpha channels. this format may be represented by the following extension names:

GL_OES_texture_compression_S3TC

GL_EXT_texture_compression_s3tc

GL_EXT_texture_compression_dxt1

GL_EXT_texture_compression_dxt3

GL_EXT_texture_compression_dxt5

3DC-3DC texture compression (3DC) supports RGB texture compression with alpha channels, but is not widely used. This format is represented by the following OpenGL extensions:

GL_AMD_compressed_3DC_texture

Warning these texture compression formats are not supported by all devices. Support for these formats may be changed by manufacturers and devices.

Note: Once you decide what texture compression formats your application supports, make sure to declare them using <supports-gl-texture> in your manifest. in this way, the application market can filter out your applications for devices that do not support the required format.

 

 

Determine OpenGL extension
The implementation of OpenGL is different from the OpenGLES API supported by extensions on data devices. These extensions include texture compression, but generally include other OpenGL feature sets.

 

 

To determine the texture compression formats supported by a device and other OpenGL extensions, run the following code on your target device:

Stringextensions = javax. microedition. khronos. opengles. GL10.glGetString (GL10.GL _ EXTENSIONS );

 

 

Warning: The call result may be different on different devices! You must run this call on multiple target devices to determine which compression formats are supported together.

View the output of this method to determine the OpenGL extensions supported on the device.

Select an OpenGLAPI version
OpenGLES API v1.0 (and 1.1) and v2.0 provide high-performance graphic interfaces for creating 3D games and visual effects and user interfaces. openGLES 1.0/1.1 APIs are significantly different from ES2.0 in graph programming. Therefore, developers should carefully consider the following factors before using one of the two APIs for development:

Performance-OpenGLES 2.0 provides higher graphics performance than ES1.0/1.1 APIs. However, performance varies with android devices, depending on the Implementation of OpenGL graphics pipelines.

Device compatibility-developers should consider the device type, Android version and OpenGLES version.

Coding convenience-OpenGL ES1.0/1.1 API provides a fixed function pipeline and convenient functions, but these functions are not available in ES2.0 API. new OpenGL developers may find that writing code with OpenGLES 1.0/1.1 is faster and more convenient.

Graphics control-OpenGL ES 2.0API provides a complete programmable pipeline by using the shader to provide a higher level of control capability. through more direct control of the graphic processing pipeline, we can develop effects that are hard to achieve for APIS 1.0/1.1.

 


Performance, compatibility, convenience, control, and other factors may affect your decision. You should choose an OpenGLAPI version based on how to establish the best user experience.

 


From the column of nkmnkm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.