MTLTexture获得黑色

时间:2018-08-29 06:47:29

标签: ios swift metal metalkit

我正在尝试实现一个支持金属的绘图应用程序,该应用程序将MTKView上沿手指位置反复用纹理正方形绘制笔触。

当我应用纹理We cannot see the texture since it is white 时。

https://imgur.com/gallery/BTnxIMl

画笔笔触的输出在半透明区域变为黑色。

最终的画笔笔触如下enter image description here

我的混合是

pipelineDescriptor.colorAttachments[0].isBlendingEnabled = true
pipelineDescriptor.colorAttachments[0].rgbBlendOperation = .add
pipelineDescriptor.colorAttachments[0].alphaBlendOperation = .add
pipelineDescriptor.colorAttachments[0].sourceRGBBlendFactor = .sourceAlpha
pipelineDescriptor.colorAttachments[0].sourceAlphaBlendFactor = .one
pipelineDescriptor.colorAttachments[0].destinationRGBBlendFactor = .oneMinusSourceAlpha
pipelineDescriptor.colorAttachments[0].destinationAlphaBlendFactor = .oneMinusSourceAlpha

0 个答案:

没有答案