Android圖形—OpenGL(二)

來源:互聯網
上載者:User

本文譯自: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>元素來聲明其所支援的格式。關於有效紋理壓縮格式的更多資訊,請看本文後續的“紋理壓縮支援”

在應用程式資訊清單中聲明紋理壓縮需求會把該應用程式從那些不支援其聲明的壓縮格式的裝置上隱藏掉(只要有一種格式不被支援)。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.