[英]Initial project error libgdx 1.0
我使用libgdx項目生成器創建了一個項目,然后將其導入Eclipse。 然后在android模擬器上運行,但出現錯誤“ libgdx需要OpenGL ES 2.0”。 我不知道是什么問題
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new MyGdxGame(), config);
}
}
public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture img;
@Override
public void create () {
batch = new SpriteBatch();
img = new Texture("badlogic.jpg");
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(img, 0, 0);
batch.end();
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygdx.game.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/GdxTheme" >
<activity
android:name="com.mygdx.game.android.AndroidLauncher"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
從1.0版開始,LibGDX不再支持<OpenGL ES 2.0。
在大多數情況下,這不是問題,因為如今不支持OpenGL ES 2.0的所有設備中只有不到0.1%。 在這里查看統計信息。
在您的情況下,這可能是仿真器的故障。 您不應該使用它來測試您的游戲,因為它非常慢,而且啟動時間非常長。 使用真實的設備並在那里運行您的應用程序,這將節省大量時間,並且您將獲得更逼真的結果。
使用LibGDX,您甚至可以跳過此步驟,因為它是跨平台框架,這意味着您可以在台式機上運行游戲進行調試和測試,而最終只能在移動設備上對其進行測試。
如果確實需要OpenGL ES 1.1支持,則可以使用仍支持它的LibGDX版本0.9.9。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.