PICCANTE  0.4
The hottest HDR imaging library!
filter_blend.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_GL_FILTERING_FILTER_BLEND_HPP
19 #define PIC_GL_FILTERING_FILTER_BLEND_HPP
20 
21 #include "../../gl/filtering/filter.hpp"
22 
23 namespace pic {
24 
28 class FilterGLBlend: public FilterGL
29 {
30 protected:
31 
35  void initShaders()
36  {
38  (
39  uniform sampler2D u_tex0; \n
40  uniform sampler2D u_tex1; \n
41  uniform sampler2D u_texMask; \n
42  out vec4 f_color; \n
43 
44  void main(void) {
45  \n
46  ivec2 coords = ivec2(gl_FragCoord.xy);\n
47  vec4 color0 = texelFetch(u_tex0, coords, 0);\n
48  vec4 color1 = texelFetch(u_tex1, coords, 0);\n
49  float weight = texelFetch(u_texMask, coords, 0).x;\n
50  f_color = mix(color0, color1, weight);
51  }\n
52  );
53 
54  technique.initStandard("330", vertex_source, fragment_source, "FilterGLBlend");
55 
56  technique.bind();
57  technique.setUniform1i("u_tex0", 0);
58  technique.setUniform1i("u_tex1", 1);
59  technique.setUniform1i("u_texMask", 2);
60  technique.unbind();
61  }
62 
63 public:
64 
69  {
70  //protected values are assigned/computed
71  initShaders();
72  }
73 
75  {
76  release();
77  }
78 };
79 
80 } // end namespace pic
81 
82 #endif /* PIC_GL_FILTERING_FILTER_BLEND_HPP */
83 
TechniqueGL technique
Definition: display.hpp:45
FilterGLBlend()
FilterGLBlend.
Definition: filter_blend.hpp:68
void bind()
bind
Definition: display.hpp:189
~FilterGLBlend()
Definition: filter_blend.hpp:74
#define MAKE_STRING(input_string)
The FilterGLBlend class.
Definition: filter_blend.hpp:28
void initShaders()
initShaders
Definition: filter_blend.hpp:35
The FilterGL class.
Definition: filter.hpp:35
bool initStandard(std::string version_number, std::string vertex_shader_source, std::string fragment_shader_source, std::string name)
initStandard
Definition: display.hpp:114
void unbind()
unbind
Definition: display.hpp:197
std::string vertex_source
Definition: display.hpp:57
Definition: bilateral_separation.hpp:25
std::string fragment_source
Definition: display.hpp:57
void release()
release
Definition: display.hpp:85
void setUniform1i(const char *name_uniform, int value0)
SetUniform.
Definition: display.hpp:236