2012-06-06 112 views
1

我努力學習的OpenGL ES 2.0,以下基本教程正常工作seteglcontextclientversion(2)不支持OpenGL ES 2.0設備

http://www.droidnova.com/android-3d-game-tutorial-part-ii,328.html

這是我GLSurfaceView推導的構造

public FirstOpenGLSurfaceView(Context context){ 
     super(context); 
     // Set the Renderer for drawing on the GLSurfaceView 
     setEGLContextClientVersion(2); 
     _renderer = new FirstOpenGLRenderer(); 
     setRenderer(_renderer); 
    } 

經過一番實驗後,我得出結論,如果發出調用seteglcontextclientversion(2)(註釋掉這行代碼和渲染工作),項目將無法正常運行。Logcat指示「調用未實現O penGL ES API「,無論何時試圖運行上述方法。

我已經更新了清單,並遵循所有的建議在此張貼在這裏...(包括manifest.xml中設置)

Android: GLES20: Called unimplemented OpenGL ES API

我聽到的建議,這可能表明,OpenGL的ES 2.0在有問題的設備上不可用(或者正在使用模擬器)。在這種情況下,我不認爲這是真的,因爲當我運行下面的代碼時...(在幾個教程中找到,我相信此代碼說實話)

// Check if the system supports OpenGL ES 2.0. 
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); 
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); 
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000; 

supportsEs2的值是 '真',這適用於三個獨立的設備,即

  • 三星Galaxy Tab 10.1 - 的Android 3.2內核2.6.36.4
  • 谷歌Nexus S - 安卓4.0.4 - 內核3.0.27
  • 三星Galaxy S3 - 安卓4.0.4與內核3.0.15

有沒有人經歷過這個?

+0

你有清單中的是否爲gles?我不確定它是否有所作爲,但是這種語言可能意味着沒有這個設備將只支持1.0。我不確定是否是這種情況。 http://developer.android.com/guide/topics/manifest/uses-feature-element.html#glEsVersion – Tim

+0

@Tim <使用sdk android:targetSdkVersion =「10」android:minSdkVersion =「10」> 在清單中(也嘗試過與SDK版本8,相同的結果) –

+0

我有問題,OpenGL 2.0不會運行後的OpenGL 1.0相同的應用。 – Zammbi

回答

0

我也面臨着我的XOLO A500S同樣的問題,並使用setEGLConfigChooser()解決我的問題:

myGLSurface.setEGLConfigChooser(5, 6, 5, 0, 24, 8); 
myGLSurface.setEGLContextClientVersion(2); 
myGLSurface.setRenderer(new MyGLRenderer()); 

我來自哪裏得到的值setEGLConfigChooser(redSize, greenSize, blueSize, alphaSize, depthSize, stencilSize)

http://gfxbench.com/result.jsp