libgdx numSamples What are the side effects
I’m trying to render some 512×512 images in a 50×50 square area in my viewport, and I’m using linear texture filtering. My virtual viewport size is 550×800 pixels. As a result, the square area where the texture is painted is scaled according to the screen resolution.
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
On the Samsung Galaxy S3 with a screen resolution of 720×1280, texture rendering is smooth and satisfying.
But aliasing issues still exist on Samsung Galaxy S2 textures with a screen resolution of 480×800. I did some searching online and found
the numSamples
parameter for AndroidApplicationConfiguration
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.numSamples = 5;
In libgdx documentation It says “2 is a good value”, but I can’t do smooth rendering until the numSamples
value is 5
My question is; What kind of side effects can cause cfg.numSamples = 5
in terms of performance, battery usage, CPU overheating, etc.?
Solution
numSamples is the number of anti-aliased samples. See http://en.wikipedia.org/wiki/Multisample_anti-aliasing for more information.
You may want to view mipmapping (TextureFilter.MipMap{Nearest/Linear}{Nearest/Linear}) texture filter. TextureFilter.MipMapLinearNearest or TextureFilter.MipMapLinearLinear may give you a better looking texture, but you need to make sure that the useMipMaps flag in the texture constructor is set to “true” to generate the mipmap.