初始项目错误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>

LibGDX不支持任何东西<OpenGL ES 2.0,自1.0版本起。

这在大多数情况下都不是问题,因为现在不支持OpenGL ES 2.0的设备不到0.1%。请参阅此处的统计数据。

在您的情况下,这可能是模拟器的故障。你不应该用它来测试你的游戏,因为它非常慢,而且需要很长时间才能开始。使用真实的设备并在那里运行你的应用程序,这将为你节省大量时间,你会得到更逼真的结果。

有了LibGDX,你甚至可以跳过这一步,因为它是一个跨平台的框架,这意味着你可以在台式电脑上运行游戏进行调试和测试,最终只能在移动设备上进行测试。

如果你真的需要OpenGL ES 1.1支持,你可以使用仍然支持它的LibGDX 0.9.9版本。

最新更新