<bdo id='tHpVw'></bdo><ul id='tHpVw'></ul>

  1. <legend id='tHpVw'><style id='tHpVw'><dir id='tHpVw'><q id='tHpVw'></q></dir></style></legend>

    <small id='tHpVw'></small><noframes id='tHpVw'>

    <i id='tHpVw'><tr id='tHpVw'><dt id='tHpVw'><q id='tHpVw'><span id='tHpVw'><b id='tHpVw'><form id='tHpVw'><ins id='tHpVw'></ins><ul id='tHpVw'></ul><sub id='tHpVw'></sub></form><legend id='tHpVw'></legend><bdo id='tHpVw'><pre id='tHpVw'><center id='tHpVw'></center></pre></bdo></b><th id='tHpVw'></th></span></q></dt></tr></i><div id='tHpVw'><tfoot id='tHpVw'></tfoot><dl id='tHpVw'><fieldset id='tHpVw'></fieldset></dl></div>
      <tfoot id='tHpVw'></tfoot>
    1. libgdx 纹理过滤器和 mipmap

      时间:2023-05-20
    2. <i id='W73of'><tr id='W73of'><dt id='W73of'><q id='W73of'><span id='W73of'><b id='W73of'><form id='W73of'><ins id='W73of'></ins><ul id='W73of'></ul><sub id='W73of'></sub></form><legend id='W73of'></legend><bdo id='W73of'><pre id='W73of'><center id='W73of'></center></pre></bdo></b><th id='W73of'></th></span></q></dt></tr></i><div id='W73of'><tfoot id='W73of'></tfoot><dl id='W73of'><fieldset id='W73of'></fieldset></dl></div>

      <small id='W73of'></small><noframes id='W73of'>

          <tfoot id='W73of'></tfoot>
              <bdo id='W73of'></bdo><ul id='W73of'></ul>
                  <tbody id='W73of'></tbody>
                <legend id='W73of'><style id='W73of'><dir id='W73of'><q id='W73of'></q></dir></style></legend>

              • 本文介绍了libgdx 纹理过滤器和 mipmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                当我尝试在 LibGDX 中使用 mipmap 过滤时,没有图像出现.

                When I try to use mipmap filtering in LibGDX, none of the images appear.

                我是 LibGDX 的新手,我有一个简单的 2d 场景,其中包含三个旋转、缩放的圆圈.为了消除它们的锯齿,我想使用线性过滤.为了获得建议,我查看了 这篇文章,它说,对于大规模缩放的图像,mipmap 可用于提高速度或质量.

                I'm new to LibGDX, and I have a simple 2d scene with three rotating, scaled circles. In order to anti-alias them, I wanted to use linear filtering. For advice, I looked to this article,which said that, for heavily scaled images, a mipmap can be used to improve speed or quality.

                第一个意外的出现是,尽管我的所有图像都按比例缩小了,但如果 magFilter 是线性的,我只会看到线性过滤器.换句话说:

                The first unexpected appearance was that, despite the fact that all of my images were scaled down, I would only see a linear filter if the magFilter was linear. In other words:

                此代码将显示缩小图像的线性过滤器:

                parentTexture.setFilter(TextureFilter.Nearest, TextureFilter.Linear);
                

                虽然此代码不会:

                parentTexture.setFilter(TextureFilter.Linear, TextureFilter.Nearest);
                

                这似乎与 libGDX 功能相反:

                void com.badlogic.gdx.graphics.Texture.setFilter(TextureFilter minFilter, TextureFilter magFilter)
                

                这不会打扰我,除了它表明 libgdx 是错误的(不太可能),文章是错误的(不太可能),或者我不了解纹理过滤器.当我尝试 mipmap 过滤器时,后者似乎特别有可能.

                This would not bother me, except that it indicates that either libgdx is wrong (unlikely), the article is wrong (unlikely), or I don't understand texture filters. The latter seems especially likely when I try mipmap filters.

                此代码不显示任何内容

                parentTexture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear);
                

                此代码显示,但使用最接近的过滤

                parentTexture.setFilter(TextureFilter.Linear, TextureFilter.MipMapLinearLinear);
                

                任何我错在哪里的解释将不胜感激.我在其他地方搜索过,但 libGDX 中的纹理过滤器非常具体,所以除了文章之外,我没有找到太多帮助.

                Any explanation of where I'm wrong would be greatly appreciated. I have searched elsewhere, but texture filters in libGDX is pretty specific, so aside from the article, I haven't found much to help.

                推荐答案

                我也遇到了同样的问题,但修复起来非常简单.创建 Texture 时,需要指定它使用 mipmap.

                I had this same problem, and the fix turned out to be insanely simple. When you create a Texture, you need to specify that it uses mipmaps.

                您所要做的就是将第二个参数传递给 Texture 构造函数,如下所示:

                All you have to do is pass a second parameter to the Texture constructor like this:

                Texture myTexture = new Texture(Gdx.files.internal("myImage.png"), true);

                您可以在此处查看 API 文档中的所有 Texture 类构造函数:http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Texture.html

                You can view all the Texture class constructors in the API docs here: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Texture.html

                这篇关于libgdx 纹理过滤器和 mipmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何在 LibGDX 中绘制 BitmapFont? 下一篇:libgdx:加载游戏中所有资源的最佳方式

                相关文章

                最新文章

                1. <legend id='zrub8'><style id='zrub8'><dir id='zrub8'><q id='zrub8'></q></dir></style></legend>

                  1. <tfoot id='zrub8'></tfoot>
                    • <bdo id='zrub8'></bdo><ul id='zrub8'></ul>
                  2. <small id='zrub8'></small><noframes id='zrub8'>

                    <i id='zrub8'><tr id='zrub8'><dt id='zrub8'><q id='zrub8'><span id='zrub8'><b id='zrub8'><form id='zrub8'><ins id='zrub8'></ins><ul id='zrub8'></ul><sub id='zrub8'></sub></form><legend id='zrub8'></legend><bdo id='zrub8'><pre id='zrub8'><center id='zrub8'></center></pre></bdo></b><th id='zrub8'></th></span></q></dt></tr></i><div id='zrub8'><tfoot id='zrub8'></tfoot><dl id='zrub8'><fieldset id='zrub8'></fieldset></dl></div>