本文譯自:http://developer.android.com/guide/topics/graphics/opengl.html
OpenGL 包
一旦使用GLSurfaceView和GLSurfaceView.Renderer類給OpenGL建立了一個View容器,那麼就可以開始使用以下的類來調用OpenGL的API:
1. OpenGL ES 1.0/1.1 API 包
android.opengl------這個包給OpenGL ES 1.0/1.1提供了一個靜態介面,並且比javax.microedition.khronos包介面具有更好的效能。
GLES10(http://developer.android.com/reference/android/opengl/GLES10.html)
GLES10Ext(http://developer.android.com/reference/android/opengl/GLES10Ext.html)
GLES11(http://developer.android.com/reference/android/opengl/GLES11.html)
GLES10Ext(http://developer.android.com/reference/android/opengl/GLES10Ext.html)
javax.microedition.khronos.opengles------這包提供了OpenGL ES 1.0/1.1的標準實現
GL10(http://developer.android.com/reference/javax/microedition/khronos/opengles/GL10.html)
GL10Ext(http://developer.android.com/reference/javax/microedition/khronos/opengles/GL10Ext.html)
GL11(http://developer.android.com/reference/javax/microedition/khronos/opengles/GL11.html)
GL11Ext(http://developer.android.com/reference/javax/microedition/khronos/opengles/GL11Ext.html)
GL11ExtensionPack(http://developer.android.com/reference/javax/microedition/khronos/opengles/GL11ExtensionPack.html)
2. OpenGL ES 2.0 API 類
android.opengl.ELES20------這個包提供OpenGL ES 2.0的介面,並且從Android2.2(API Level 8)開始有效。
如果想要立即建立與OpenGL有關的應用程式,請看OpenGL ES 1.0或OpenGL ES 2.0開發指南。
OpenGL ES 1.0:http://developer.android.com/resources/tutorials/opengl/opengl-es10.html
OpenGL ES 2.0:http://developer.android.com/resources/tutorials/opengl/opengl-es20.html
聲明OpenGL的需求
如果應用程式使用的OpenGL功能不是在所有的裝置上都是有效,那麼就必須在該應用的AndroidManifest.xml檔案中包含這些功能需求。
通常OpenGL清單的聲明如下:
1. OpenGL ES的版本需求---如果應用程式只支援OpenGL ES 2.0,那麼就必須通過把下列設定添加到清單中來聲明該需求:
<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"
/>
添加這個聲明後,會導致Google Play限制該應用程式安裝在那些不支援OpenGL ES 2.0的裝置上。
2. 紋理壓縮的需求---如果應用程式使用了紋理壓縮格式。就必須在該應用的資訊清單檔中使用<supports-gl-texture>元素來聲明其所支援的格式。關於有效紋理壓縮格式的更多資訊,請看本文後續的“紋理壓縮支援”
在應用程式資訊清單中聲明紋理壓縮需求會把該應用程式從那些不支援其聲明的壓縮格式的裝置上隱藏掉(只要有一種格式不被支援)。