ome-qtwidgets 5.3.2

V330GLImageShader2D.h
1 /*
2 * #%L
3 * OME-QTWIDGETS C++ library for display of OME-Files pixel data and metadata.
4 * %%
5 * Copyright © 2014 - 2015 Open Microscopy Environment:
6 * - Massachusetts Institute of Technology
7 * - National Institutes of Health
8 * - University of Dundee
9 * - Board of Regents of the University of Wisconsin-Madison
10 * - Glencoe Software, Inc.
11 * %%
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * The views and conclusions contained in the software and documentation are
34 * those of the authors and should not be interpreted as representing official
35 * policies, either expressed or implied, of any organization.
36 * #L%
37 */
38
39 #ifndef OME_QTWIDGETS_GLSL_V330_V330GLIMAGESHADER2D_H
40 #define OME_QTWIDGETS_GLSL_V330_V330GLIMAGESHADER2D_H
41
42 #include <QOpenGLShader>
43 #include <QOpenGLBuffer>
44 #include <QtGui/QOpenGLFunctions_3_3_Core>
45
46 #include <ome/files/Types.h>
47
48 #include <ome/qtwidgets/glm.h>
49
50 namespace ome
51 {
52 namespace qtwidgets
53 {
55 namespace glsl
56 {
58 namespace v330
59 {
60
64 class GLImageShader2D : public QOpenGLShaderProgram,
65 protected QOpenGLFunctions_3_3_Core
66 {
67 Q_OBJECT
68
69 public:
75 explicit GLImageShader2D(QObject *parent = 0);
76
78 ~GLImageShader2D();
79
81 void
82 enableCoords();
83
85 void
86 disableCoords();
87
96 void
97 setCoords(const GLfloat *offset = 0,
98 int tupleSize = 2,
99 int stride = 0);
100
109 void
110 setCoords(QOpenGLBuffer& coords,
111 const GLfloat *offset = 0,
112 int tupleSize = 2,
113 int stride = 0);
114
116 void
117 enableTexCoords();
118
120 void
121 disableTexCoords();
122
131 void
132 setTexCoords(const GLfloat *offset = 0,
133 int tupleSize = 2,
134 int stride = 0);
135
145 void
146 setTexCoords(QOpenGLBuffer& coords,
147 const GLfloat *offset = 0,
148 int tupleSize = 2,
149 int stride = 0);
150
156 void
157 setTexture(int texunit);
158
164 void
165 setMin(const glm::vec3& min);
166
172 void
173 setMax(const glm::vec3& max);
174
188 void
189 setCorrection(const glm::vec3& corr);
190
196 void
197 setLUT(int texunit);
198
204 void
205 setModelViewProjection(const glm::mat4& mvp);
206
207 private:
209 QOpenGLShader *vshader;
211 QOpenGLShader *fshader;
212
214 int attr_coords;
216 int attr_texcoords;
218 int uniform_mvp;
220 int uniform_texture;
222 int uniform_lut;
224 int uniform_min;
226 int uniform_max;
228 int uniform_corr;
229 };
230
231 }
232 }
233 }
234 }
235
236 #endif // OME_QTWIDGETS_GLSL_V330_V330GLIMAGESHADER2D_H
237
238 /*
239 * Local Variables:
240 * mode:C++
241 * End:
242 */
ome::qtwidgets::glsl::v330::GLImageShader2D::attr_coords
int attr_coords
Vertex coordinates attribute.
Definition: V330GLImageShader2D.h:214
ome::qtwidgets::glsl::v330::GLImageShader2D::setCorrection
void setCorrection(const glm::vec3 &corr)
Set correction multipliers to normalise pixel intensity.
Definition: V330GLImageShader2D.cpp:249
ome::qtwidgets::glsl::v330::GLImageShader2D::setMax
void setMax(const glm::vec3 &max)
Set maximum limits for linear contrast.
Definition: V330GLImageShader2D.cpp:242
ome::qtwidgets::glsl::v330::GLImageShader2D::setLUT
void setLUT(int texunit)
Set the LUT to use.
Definition: V330GLImageShader2D.cpp:256
ome::qtwidgets::glsl::v330::GLImageShader2D::GLImageShader2D
GLImageShader2D(QObject *parent=0)
Constructor.
Definition: V330GLImageShader2D.cpp:57
ome::qtwidgets::glsl::v330::GLImageShader2D::uniform_max
int uniform_max
Maximum limits for linear contrast uniform.
Definition: V330GLImageShader2D.h:226
ome::qtwidgets::glsl::v330::GLImageShader2D::setCoords
void setCoords(const GLfloat *offset=0, int tupleSize=2, int stride=0)
Set vertex coordinates from array.
Definition: V330GLImageShader2D.cpp:183
ome::qtwidgets::glsl::v330::GLImageShader2D::uniform_lut
int uniform_lut
LUT uniform.
Definition: V330GLImageShader2D.h:222
ome::qtwidgets::glsl::v330::GLImageShader2D::fshader
QOpenGLShader * fshader
The fragment shader.
Definition: V330GLImageShader2D.h:211
ome::qtwidgets::glsl::v330::GLImageShader2D::disableTexCoords
void disableTexCoords()
Disable texture coordinates.
Definition: V330GLImageShader2D.cpp:203
ome
Open Microscopy Environment C++.
ome::qtwidgets::glsl::v330::GLImageShader2D::uniform_texture
int uniform_texture
Texture uniform.
Definition: V330GLImageShader2D.h:220
ome::qtwidgets::glsl::v330::GLImageShader2D::disableCoords
void disableCoords()
Disable vertex coordinates.
Definition: V330GLImageShader2D.cpp:177
ome::qtwidgets::glsl::v330::GLImageShader2D::uniform_min
int uniform_min
Minimum limits for linear contrast uniform.
Definition: V330GLImageShader2D.h:224
ome::qtwidgets::glsl::v330::GLImageShader2D::enableCoords
void enableCoords()
Enable vertex coordinates.
Definition: V330GLImageShader2D.cpp:171
ome::qtwidgets::glsl::v330::GLImageShader2D::setTexCoords
void setTexCoords(const GLfloat *offset=0, int tupleSize=2, int stride=0)
Set texture coordinates from array.
Definition: V330GLImageShader2D.cpp:209
ome::qtwidgets::glsl::v330::GLImageShader2D
2D image shader program (simple, up to three channels).
Definition: V330GLImageShader2D.h:64
ome::qtwidgets::glsl::v330::GLImageShader2D::setModelViewProjection
void setModelViewProjection(const glm::mat4 &mvp)
Set model view projection matrix.
Definition: V330GLImageShader2D.cpp:263
ome::qtwidgets::glsl::v330::GLImageShader2D::uniform_corr
int uniform_corr
Correction multiplier for linear contrast uniform.
Definition: V330GLImageShader2D.h:228
ome::qtwidgets::glsl::v330::GLImageShader2D::enableTexCoords
void enableTexCoords()
Enable texture coordinates.
Definition: V330GLImageShader2D.cpp:197
ome::qtwidgets::glsl::v330::GLImageShader2D::uniform_mvp
int uniform_mvp
Model view projection uniform.
Definition: V330GLImageShader2D.h:218
ome::qtwidgets::glsl::v330::GLImageShader2D::setMin
void setMin(const glm::vec3 &min)
Set minimum limits for linear contrast.
Definition: V330GLImageShader2D.cpp:235
ome::qtwidgets::glsl::v330::GLImageShader2D::attr_texcoords
int attr_texcoords
Texture coordinates attribute.
Definition: V330GLImageShader2D.h:216
ome::qtwidgets::glsl::v330::GLImageShader2D::setTexture
void setTexture(int texunit)
Set the texture to render.
Definition: V330GLImageShader2D.cpp:228
ome::qtwidgets::glsl::v330::GLImageShader2D::vshader
QOpenGLShader * vshader
The vertex shader.
Definition: V330GLImageShader2D.h:209
ome::qtwidgets::glsl::v330::GLImageShader2D::~GLImageShader2D
~GLImageShader2D()
Destructor.
Definition: V330GLImageShader2D.cpp:166