日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

workaround for %33 texture memory bug

發布時間:2023/12/9 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 workaround for %33 texture memory bug 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

原帖鏈接:http://www.cocos2d-iphone.org/forum/topic/29121

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.
(?http://www.cocos2d-iphone.org/forum/topic/23887#post-129097?)

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:

#define 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:
https://devforums.apple.com/thread/113889?start=0&tstart=0

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

總結

以上是生活随笔為你收集整理的workaround for %33 texture memory bug的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。