博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
workaround for %33 texture memory bug
阅读量:5317 次
发布时间:2019-06-14

本文共 1404 字,大约阅读时间需要 4 分钟。

原帖链接:

PS:

为什么要关心 NPOT 呢?

因为苹果的OpenGL驱动有一个bug,导致如果使用 POT 的纹理,则会产生额外33%的内存消耗。

So,

If you didn't know, when you create a texture, iOS will allocate 33% more memory, presumably to have enough room in case mipmaps are needed.

(  )

But it is worth noting that this bug is only present on POT (Power Of Two) textures ( Mipmapping is only supported on POT textures ).

So, in order to reduce memory, what you have to do is two create NPOT textures.

eg:

If you are using a 2048x2048 textures, convert it into a 2048x2047 textures (and you will save 33% memory).
In case you can't make it smaller, then make it bigger. eg:
If you have a 2048x1024 texture, create a 2048x1025 texture.

If you are using cocos2d v1.0, then you have to edit ccConfig.h with:

# CC_TEXTURE_NPOT_SUPPORT 1

If you are using v1.1 or v2.0, then you are OK, since they already support NPOT textures by default.

Ways to know if you are using POT / NPOT textures:

A) Parse your PNG, GIF, BMP, JPEG files with file:

$ find . -name "*.png" -print0 | xargs -0 file

B) Run this line of code and see your debug console:

[[CCTextureCache sharedTextureCache] dumpCachedTextureInfo];

Further info:

Important: NPOT textures can't have mipmaps, and also they only accept GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}

Important 2: PVRTC (2bpp and 4bpp) textures can't be converted to NPOT

转载于:https://www.cnblogs.com/java20130723/archive/2013/01/26/3212056.html

你可能感兴趣的文章
ubuntu 18.04取消自动锁屏以及设置键盘快捷锁屏
查看>>
Leetcode 589. N-ary Tree Preorder Traversal
查看>>
机器学习/深度学习/其他开发环境搭建记录
查看>>
xml.exist() 实例演示
查看>>
判断是否为空然后赋值
查看>>
zabbix监控日志文件
查看>>
正则表达式
查看>>
pip install torch on windows, and the 'from torch._C import * ImportError: DLL load failed:' s...
查看>>
java基础(一):我对java的三个环境变量的简单理解和配置
查看>>
arcgis api 4.x for js 结合 Echarts4 实现散点图效果(附源码下载)
查看>>
YTU 2625: B 构造函数和析构函数
查看>>
apache自带压力测试工具ab的使用及解析
查看>>
C#使用Xamarin开发可移植移动应用(2.Xamarin.Forms布局,本篇很长,注意)附源码
查看>>
jenkins搭建
查看>>
C#中使用Split分隔字符串的技巧
查看>>
eclipse的调试方法的简单介绍
查看>>
加固linux
查看>>
IPSP问题
查看>>
10.17动手动脑
查看>>
WPF中Image显示本地图片
查看>>