PICCANTE  0.4
The hottest HDR imaging library!
filter_remapping.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_REMAPPING_HPP
19 #define PIC_GL_FILTERING_FILTER_REMAPPING_HPP
20 
21 #include "../../base.hpp"
22 
23 #include "../../gl/filtering/filter.hpp"
24 
25 namespace pic {
26 
31 {
32 protected:
33 
37  void initShaders()
38  {
39  /*
40  *
41  * 0 ---> Drago et al. 2003
42  * 1 ---> Reinhard et al. 2002
43  * LumZone = [-2, -1, 0, 1, 2, 3, 4];
44  * TMOForZone = [ 0, 0, 1, 0, 1, 0, 0];
45  */
46 
48  (
49  uniform sampler2D u_tex; \n
50  s out vec4 f_color; \n
51  void main(void) { \n
52  ivec2 coords = ivec2(gl_FragCoord.xy); \n
53  int indx = int(texelFetch(u_tex, coords, 0).x + 2.0); \n
54  indx = (indx == 2) ? 1 : 0; \n
55  indx = (indx == 4) ? 1 : indx;\n
56  f_color = vec4(vec3(float(indx)), 1.0);\n
57  }
58  );
59 
60  technique.initStandard("330", vertex_source, fragment_source, "FilterGLRemapping");
61 
62  technique.bind();
63  technique.setUniform1i("u_tex", 0);
64  technique.unbind();
65  }
66 
67 public:
72  {
73  initShaders();
74  }
75 
77  {
78  release();
79  }
80 };
81 
82 } // end namespace pic
83 
84 #endif /* PIC_GL_FILTERING_FILTER_REMAPPING_HPP */
85 
~FilterGLRemapping()
Definition: filter_remapping.hpp:76
TechniqueGL technique
Definition: display.hpp:45
void bind()
bind
Definition: display.hpp:189
#define MAKE_STRING(input_string)
The FilterGLRemapping class.
Definition: filter_remapping.hpp:30
void initShaders()
initShaders
Definition: filter_remapping.hpp:37
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
FilterGLRemapping()
FilterGLRemapping.
Definition: filter_remapping.hpp:71
void release()
release
Definition: display.hpp:85
void setUniform1i(const char *name_uniform, int value0)
SetUniform.
Definition: display.hpp:236