简体   繁体   English

初始项目错误libgdx 1.0

[英]Initial project error libgdx 1.0

I have created a project using libgdx project generator, then I imported him to Eclipse. 我使用libgdx项目生成器创建了一个项目,然后将其导入Eclipse。 Then run on android emulator, but there is an error "libgdx requires OpenGL ES 2.0". 然后在android模拟器上运行,但出现错误“ libgdx需要OpenGL ES 2.0”。 I dont know what is the problem 我不知道是什么问题

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 does not support anything < OpenGL ES 2.0 anymore, since version 1.0. 从1.0版开始,LibGDX不再支持<OpenGL ES 2.0。

That's not a problem in most cases, because nowadays there are less than 0.1% of all devices which do not support OpenGL ES 2.0. 在大多数情况下,这不是问题,因为如今不支持OpenGL ES 2.0的所有设备中只有不到0.1%。 See the statistics here . 这里查看统计信息。

In your case it is probably the fault of the emulator. 在您的情况下,这可能是仿真器的故障。 You should not use that to test your games, since it is terribly slow and takes extremely long to start. 您不应该使用它来测试您的游戏,因为它非常慢,而且启动时间非常长。 Use a real device and run your app there, which will save you a lot of time and you will get more realistic results. 使用真实的设备并在那里运行您的应用程序,这将节省大量时间,并且您将获得更逼真的结果。

With LibGDX, you can even skip this step, since it is a cross platform framework, meaning that you can just run your game on your desktop PC for debugging and testing and only in the end test it on mobile devices. 使用LibGDX,您甚至可以跳过此步骤,因为它是跨平台框架,这意味着您可以在台式机上运行游戏进行调试和测试,而最终只能在移动设备上对其进行测试。

If you really need OpenGL ES 1.1 support, you can use LibGDX version 0.9.9, which still supported it. 如果确实需要OpenGL ES 1.1支持,则可以使用仍支持它的LibGDX版本0.9.9。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM