WebGL 1 中是否有 blendFunci 的等价物?
Is there equivalent for `blendFunci` in WebGL 1?
我正在从事 WebGL 1 项目。我需要在自定义片段着色器中使用 gl_FragData[0]
和 gl_FragData[1]
。如何为 gl_FragData[1]
设置 blendFunction。我认为 OpenGL 使用 glBlendFunci
。例如,glBlendFunc(1, gl.ONE, gl.ONE)
。我怎样才能在 WebGL 中做到这一点?
WebGL1 中没有 glBlendFunci
等效项。要进行自定义混合,正常的解决方案是获取 2 个纹理,将它们混合在着色器中,然后输出到新纹理
uniform sampler2D t1;
uniform sampler2D t2;
void main() {
gl_FragColor = someOperation(t1, t2);
}
做不止一个就是重复
中的同一件事
uniform sampler2D t1;
uniform sampler2D t2;
uniform sampler2D t3;
uniform sampler2D t4;
void main() {
gl_FragData[0] = someOperation(t1, t2);
gl_FragData[1] = someOperation(t3, t4);
}
我正在从事 WebGL 1 项目。我需要在自定义片段着色器中使用 gl_FragData[0]
和 gl_FragData[1]
。如何为 gl_FragData[1]
设置 blendFunction。我认为 OpenGL 使用 glBlendFunci
。例如,glBlendFunc(1, gl.ONE, gl.ONE)
。我怎样才能在 WebGL 中做到这一点?
WebGL1 中没有 glBlendFunci
等效项。要进行自定义混合,正常的解决方案是获取 2 个纹理,将它们混合在着色器中,然后输出到新纹理
uniform sampler2D t1;
uniform sampler2D t2;
void main() {
gl_FragColor = someOperation(t1, t2);
}
做不止一个就是重复
中的同一件事 uniform sampler2D t1;
uniform sampler2D t2;
uniform sampler2D t3;
uniform sampler2D t4;
void main() {
gl_FragData[0] = someOperation(t1, t2);
gl_FragData[1] = someOperation(t3, t4);
}