成都创新互联网站制作重庆分公司

基于Qt的OpenGL可编程管线学习(17)-差值、反差值、排除

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 = abs(vec4(blendColor.rgb - baseColor.rgb, 1.0));
}

效果图

基于Qt的OpenGL可编程管线学习(17)- 差值、反差值、排除

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(vec3(1.0) - abs(vec3(blendColor.rgb - baseColor.rgb)), 1.0);
}

效果图

基于Qt的OpenGL可编程管线学习(17)- 差值、反差值、排除

3、排除

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(blendColor.rgb + baseColor.rgb - 2.0 * blendColor.rgb * baseColor.rgb, 1.0);
}

效果图

基于Qt的OpenGL可编程管线学习(17)- 差值、反差值、排除


名称栏目:基于Qt的OpenGL可编程管线学习(17)-差值、反差值、排除
URL分享:http://cxhlcq.com/article/jeidep.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部