【问题标题】:How load a lot of textures in andengine如何在andengine中加载大量纹理
【发布时间】:2012-02-15 06:30:00
【问题描述】:

我正在尝试按如下方式加载纹理:

private Texture mTexture;
...
    public Textures(final BaseGameActivity activity, final Engine engine) {

        this.mTexture = new Texture(2048, 1024,
                TextureOptions.BILINEAR_PREMULTIPLYALPHA);


        this.mBackgroundTextureRegion = TextureRegionFactory.createFromAsset(
                this.mTexture, activity, "img/back.png", 0, 0);


        this.mSwingBackTextureRegion = TextureRegionFactory.createFromAsset(
                this.mTexture, activity, "img/player.png", 836, 0);
...

我想加载超过 200 个纹理。但是,我使用的当前方法太长了。

有没有更快的方法来完成它?

我在GLES1工作。

【问题讨论】:

    标签: android textures andengine


    【解决方案1】:

    最简单的方法是使用 Texture Packer,found here

    这允许您将多个图像文件添加到一个易于加载的精灵表中。引擎将此 spritesheet 加载到纹理中并创建一个类,让您可以轻松地引用该电子表格中的每个图像。将 200 个 TextureRegions 转换为 1 个 TexturePack。

    我正在使用 GLES2,但我不确定 GLES1 的源文件在哪里。浏览论坛,您应该能够了解如何使用它们。已经有很多讨论了。

    【讨论】:

      【解决方案2】:

      AndEngine 中内置了一个纹理打包器,可以自动执行此操作。尝试搜索 AndEngine 论坛。 http://www.andengine.org/forums/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多