基于Qt的OpenGL可编程管线学习(18)-平滑、锐化、边缘检测
1、平滑
创新互联公司一直在为企业提供服务,多年的磨炼,使我们在创意设计,全网整合营销推广到技术研发拥有了开发经验。我们擅长倾听企业需求,挖掘用户对产品需求服务价值,为企业制作有用的创意设计体验。核心团队拥有超过10年以上行业经验,涵盖创意,策化,开发等专业领域,公司涉及领域有基础互联网服务成都服务器托管、成都app开发、手机移动建站、网页设计、网络整合营销。
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效果图
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效果图
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)-平滑、锐化、边缘检测
网站URL:http://myzitong.com/article/pjoddi.html