标签:qt opengl shader 正片叠底 逆正片叠底
1、正片叠底
shader
// 正片叠底 uniform sampler2D U_MainTexture; uniform sampler2D U_SubTexture; varying vec2 M_coord; void main() { vec4 blendColor = texture2D(U_SubTexture, M_coord); vec4 baseColor = texture2D(U_MainTexture, M_coord); gl_FragColor = blendColor * baseColor; }
效果图
2、逆正片叠底
shader
// 逆正片叠底 uniform sampler2D U_MainTexture; uniform sampler2D U_SubTexture; varying vec2 M_coord; void main() { vec4 blendColor = texture2D(U_SubTexture, M_coord); vec4 baseColor = texture2D(U_MainTexture, M_coord); gl_FragColor = vec4(1.0) - (vec4(1.0) - blendColor) * (vec4(1.0) - baseColor); }
效果图
本文出自 “不会飞的纸飞机” 博客,请务必保留此出处http://douzhq.blog.51cto.com/12552184/1931104
基于Qt的OpenGL可编程管线学习(14)- 正片叠底、逆正片叠底
标签:qt opengl shader 正片叠底 逆正片叠底
原文地址:http://douzhq.blog.51cto.com/12552184/1931104