基于Qt的OpenGL可编程管线学习(18)-平滑、锐化、边缘检测-创新互联

1、平滑

在庐江等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站建设、做网站 网站设计制作按需定制网站,公司网站建设,企业网站建设,品牌网站制作,成都营销网站建设,成都外贸网站制作,庐江网站建设费用合理。

shader

// 平滑
uniform sampler2D U_MainTexture;
uniform sampler2D U_SubTexture;

varying vec2 M_coord;

void main()
{
        vec4 color = vec4(0.0);
        int coreSize = 3;
        float texelOffset = 1 / 300.0;
        float kernel[9];

        kernel[6] = 1; kernel[7] = 1; kernel[8] = 1;
        kernel[3] = 1; kernel[4] = 1; kernel[5] = 1;
        kernel[0] = 1; kernel[1] = 1; kernel[2] = 1;

        int index = 0;
        for(int y = 0; y

效果图

基于Qt的OpenGL可编程管线学习(18)- 平滑、锐化、边缘检测

2、锐化

shader

// 锐化
uniform sampler2D U_MainTexture;
uniform sampler2D U_SubTexture;

varying vec2 M_coord;

void main()
{
        vec4 color = vec4(0.0);
        int coreSize = 3;
        float texelOffset = 1 / 300.0;
        float kernel[9];

        kernel[6] = 0; kernel[7] = -1; kernel[8] = 0;
        kernel[3] = -1; kernel[4] = 4; kernel[5] = -1;
        kernel[0] = 0; kernel[1] = -1; kernel[2] = 0;

        int index = 0;
        for(int y = 0; y

效果图

基于Qt的OpenGL可编程管线学习(18)- 平滑、锐化、边缘检测

3、边缘检测

shader

//  边缘检测
uniform sampler2D U_MainTexture;
uniform sampler2D U_SubTexture;

varying vec2 M_coord;

void main()
{
        vec4 color = vec4(0.0);
        int coreSize = 3;
        float texelOffset = 1 / 300.0;
        float kernel[9];

        kernel[6] = 0; kernel[7] = 1; kernel[8] = 0;
        kernel[3] = 1; kernel[4] = -4; kernel[5] = 1;
        kernel[0] = 0; kernel[1] = 1; kernel[2] = 0;

        int index = 0;
        for(int y = 0; y

效果图

基于Qt的OpenGL可编程管线学习(18)- 平滑、锐化、边缘检测

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:基于Qt的OpenGL可编程管线学习(18)-平滑、锐化、边缘检测-创新互联
URL地址:http://ybzwz.com/article/dhdehc.html