AndEngine中TextureOptions的区别
来源:互联网 发布:阿里云最便宜服务器 编辑:程序博客网 时间:2024/04/30 09:32
在学习AndEngine中的贴图,发现TextureOptions有多种选项在源码中如下:
public static final TextureOptions NEAREST = new TextureOptions(GLES20.GL_NEAREST, GLES20.GL_NEAREST, GLES20.GL_CLAMP_TO_EDGE, GLES20.GL_CLAMP_TO_EDGE, false);public static final TextureOptions BILINEAR = new TextureOptions(GLES20.GL_LINEAR, GLES20.GL_LINEAR, GLES20.GL_CLAMP_TO_EDGE, GLES20.GL_CLAMP_TO_EDGE, false);public static final TextureOptions REPEATING_NEAREST = new TextureOptions(GLES20.GL_NEAREST, GLES20.GL_NEAREST, GLES20.GL_REPEAT, GLES20.GL_REPEAT, false);public static final TextureOptions REPEATING_BILINEAR = new TextureOptions(GLES20.GL_LINEAR, GLES20.GL_LINEAR, GLES20.GL_REPEAT, GLES20.GL_REPEAT, false);public static final TextureOptions NEAREST_PREMULTIPLYALPHA = new TextureOptions(GLES20.GL_NEAREST, GLES20.GL_NEAREST, GLES20.GL_CLAMP_TO_EDGE, GLES20.GL_CLAMP_TO_EDGE, true);public static final TextureOptions BILINEAR_PREMULTIPLYALPHA = new TextureOptions(GLES20.GL_LINEAR, GLES20.GL_LINEAR, GLES20.GL_CLAMP_TO_EDGE, GLES20.GL_CLAMP_TO_EDGE, true);public static final TextureOptions REPEATING_NEAREST_PREMULTIPLYALPHA = new TextureOptions(GLES20.GL_NEAREST, GLES20.GL_NEAREST, GLES20.GL_REPEAT, GLES20.GL_REPEAT, true);public static final TextureOptions REPEATING_BILINEAR_PREMULTIPLYALPHA = new TextureOptions(GLES20.GL_LINEAR, GLES20.GL_LINEAR, GLES20.GL_REPEAT, GLES20.GL_REPEAT, true);public static final TextureOptions DEFAULT = NEAREST;
在其论坛中有网友给出了如下说明:
- NEAREST: Faster then BILINEAR as only the nearest pixel on the Texture is used (Sprites tend to look pixelated when, physical resolution is higher or lower than texture resolution. Up/Down-scaling)
- BILINEAR: Slower than NEAREST, but looks better, as not only one pixel from the texture is fetched but the 4 nearest.
The difference between those and the REPEATING TextureOptions is the way OpenGL treats TextureCoordinates that are out of the physical bounds of the Texture (usually ranging from 0.0 to 1.0).
Where REPEATING paints the Texture twice when the coordinates go from 0.0 to 2.0, NON-REPEATING will stretch the outermost pixel of the Texture what looks pretty ugly.
So the REPEATING TextureOptions are used only in very special cases.
For a description what the PREMULTIPLYALPHA-thing is, have a look here: 点击打开链接
大致就是说NEAREST要比BILINEAR快,因为NEAREST在缩放时使用距离缩放位置最近的一个像素而BILINEAR要使用最近的4个像素来确定缩放位置的最终显示效果。但是BILINEAR所得到的效果要比EAREST好。
带REPEATING的只在特殊情况下使用。
- AndEngine中TextureOptions的区别
- Andengine中的TextureOptions
- AndEngine-----Example中Simple例子的总结
- AndEngine学习笔记10-Physics(andengine中使用Box2D的PhysicsWorld介绍)
- Andengine 中可变文本 Text 使用中遇到的问题
- andengine中tiledmap中角色行走的细节处理
- android andengine游戏引擎中图片资源的加密
- AndEngine中手柄的使用——DigitalOnScreenControl && AnalogOnScreenControl
- 解决在androidStudio中使用AndEngine时报错的问题
- andengine-1:andengine开发环境的搭建
- AndEngine开发的华容道
- AndEngine引擎的生命周期
- AndEngine引擎的配置
- andengine的RepeatingSpriteBackground
- andengine的convertLocalCoordinatesToSceneCoordinates方法
- Andengine
- andengine
- AndEngine 中TMX地图编辑器
- linux线程(一)
- 反汇编算法介绍和应用——线性扫描算法分析
- 数据库中的NULL 在mfc界面中显示的结果
- 使用dx9sdk为vs2008 搭建directx环境
- poj 3304
- AndEngine中TextureOptions的区别
- 对于代理模式的理解
- 共享存储(—)nfs服务搭建
- struts.xml中的default-action-ref问题
- 看看老外是怎么学排序算法的
- JAVA/Android 读写文件,避免中文乱码 FileWriter乱码
- linux线程 (二)
- php学习基础
- jquery dropdownlist