gpt4 book ai didi

ios - PNG 预乘 Alpha,iOS 模拟器与 iPad

转载 作者:行者123 更新时间:2023-12-01 19:15:36 25 4
gpt4 key购买 nike

我用 GLKTextureLoader加载 32 位 PNG(在 GIMP 中创建)。 GLKTextureInfo返回显示GLKTextureInfoAlphaStateNonPremultiplied对于alphaState在模拟器和 iPad 上。试用 glBlendFunc和 GLKTextureLoader 我可以让它在 iPad 或模拟器上工作,但不能同时在两者上工作!

没有 GLKTextureLoader 的选项,并且具有以下混合函数:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

我上了 iOS 模拟器(注意文字上的光芒很亮)

enter image description here

在第 4 台 iPad 上(注意文本上的发光是暗的)

enter image description here

为什么有区别? alphaState是一样的。会是什么呢?

最佳答案

我在 Apple Discussion 上找到了答案.

I have the exact same problem. XCode will convert PNG images so that the header chunk is CgBI (instead of IHDR), and that confuses 3rd party libs like libpng, since a character in Apple's header indicates that the data is in a private format. This operation only takes place for the target device - the simulator is unaffected. There are 4 ways to work around the issue (from easiest to hardest).

1) Rename your images to something else (eg. .ppng), and the XCode packaging tool will ignore your file.

2) According to the following link (http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES1xMBX.asp), you need to add the following build settings defintion for each target. IPHONEOPTIMIZEOPTIONS=-skip-PNGs I'm embaressed to say that I still haven't figured out where in XCode project settings to add this.

3) Teach your PNG decoder to handle Apple's CgBI format.

4) Use the Cocoa UIImage classes or the Texture2D.m class.



编辑:在“build设置”的“打包”中,我找到了默认为"is"的“压缩 PNG 文件”选项。

关于ios - PNG 预乘 Alpha,iOS 模拟器与 iPad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13596065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com