我绘制了固定间隔重叠的小方块,使其感觉像绘图应用程序中的纹理画笔。
目前我使用的是Pipeline Descriptor
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
我的目标是当两个笔划相互交叉时,我希望在OpenGL中使用像Blend模式添加剂这样的白色
我附上了我目前得到的照片。
当斯托克斯穿过它时,它应该显示为白色。
建议一种方法来实现
看起来您没有在MTLRenderPipelineColorAttachmentDescriptor上设置blendingEnabled属性。此外,请确保使用sRGB纹理,以便采样器知道如何在混合时将8位值解码为线性光。