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 at Fixed Frame rates. RGB textures can be used 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.

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.