本文介绍了LibGDX - 在不同的手机分辨率的纹理质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用libGDX做了一个游戏。我想工作的任何电话,所以本场比赛保持纵横比,无论在手机的分辨率。我用这个教程 - http://www.acamara.es/blog/2012/02/keep-screen-aspect-ratio-with-different-resolutions-using-libgdx/

I made a game using libGDX.I wanted to work on any phone, so the game keeps the aspect ratio no matter the phone resolution.I used this tutorial - http://www.acamara.es/blog/2012/02/keep-screen-aspect-ratio-with-different-resolutions-using-libgdx/

游戏分辨率为480x770。这看起来完美的在我的手机是480×800像素。但是,如果我把游戏在手机上用小320x480分辨率的质量也没有那么好。

The game resolution is 480x770.This looks perfect on my phone that is 480x800 px.But If i put the game on a phone with 320x480 resolution the quality is not as good.

在游戏窗口是480×800

When the game window is 480x800

在游戏窗口小于480×800

When the game window is smaller than 480x800

推荐答案

如果您已加载的纹理你应该可以通过调用设置了过滤器:
texture.setFilter(TextureFilter.MipMapLinearLinear,​​TextureFilter.MipMapLinearLinear);

If you have loaded your Texture you should be able to set its filter by calling:
texture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.MipMapLinearLinear);

播放角落找寻与 TextureFilter.xxx 的constans,并使用一个谁最适合您。你也可以告诉你的纹理来使用纹理映射,当你创建:新的纹理(的FileHandle小时,布尔useMipMap)。如果您使用的是 TextureAtlas 你应该看到的过滤器中的.pack或.atlas文件中,如在此的。重要的是,大多数时间在线性版本国税发过滤器和纹理映射( MipMapLinearLinear )的最佳qualiy,但最糟糕的表现。该最近版本( MipMapNearestNearest ),而不是有质量最差,但最好的性能(大部分时间)。因此,尝试了所有的版本,然后用你最喜欢的过滤器。

Play arround with the TextureFilter.xxx constans and use the one who works best for you.You can also tell your Texture to use mipmapping when you create it: new Texture(FileHandle h, boolean useMipMap).If you are using TextureAtlas you should see the filter in the ".pack" or ".atlas" file, as shown in this tutorial.Important is, that most times the Linear version ofthe filter and mipmapping (MipMapLinearLinear) has best qualiy, but worst performance. The Nearest version (MipMapNearestNearest) instead has worst quality but best performance (most times). So try out all versions and then use the filter you like the best.

这篇关于LibGDX - 在不同的手机分辨率的纹理质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 20:58