Visualisierung 2
Comparison of Hue Preserving Rendering to Alpha Composing
GLRenderWidget.h
Go to the documentation of this file.
1 
8 #ifndef GL_RENDER_WIDGET_H
9 #define GL_RENDER_WIDGET_H
10 
11 #include <QOpenGLWidget>
12 #include <QOpenGLFunctions>
13 
14 #include <QOpenGLBuffer>
15 #include <QOpenGLVertexArrayObject>
16 
17 #include <QOpenGLShader>
18 #include <QOpenGLTexture>
19 
20 #include <QOpenGLDebugLogger>
21 
22 #include "Renderable.h"
23 #include <QColor>
24 
25 #include <memory>
26 #include <vector>
27 
31 class GLRenderWidget : public QOpenGLWidget, protected QOpenGLFunctions
32 {
33 
34 public:
35  GLRenderWidget(QWidget *parent);
37 
43  void setShader(const std::string& vert, const std::string& frag);
44 
49  void setRenderObject(RenderData& data);
50 
55  void setVolumeTexture(QOpenGLTexture* volume3Dtex);
56 
63  void setRegion(float sep, QColor c1, QColor c2);
64 
69  void setOrientation(int ori);
70 
71 protected:
72  QOpenGLShaderProgram* shader;
74 
75  QOpenGLVertexArrayObject vao;
76  QOpenGLBuffer vbo;
77  QOpenGLBuffer indices;
78 
82  void initializeGL();
88  void resizeGL(int width, int height);
89 
93  void paintGL();
94 
95  QOpenGLDebugLogger* logger;
96 
97 private:
101  void updateVBOs();
102 
103  bool hasData;
104  bool hasShader;
105  bool hasRegionSeperatorValueAndColors;
106  bool dirty;
107  size_t numVerts;
108 
109  QOpenGLTexture* volume;
110 
111  // Transfer function parameters
112  int orientation;
113  float regionSeperator;
114  QColor regionColor1;
115  QColor regionColor2;
116 
117 };
118 
119 #endif
void setRenderObject(RenderData &data)
setRenderObject sets vertex positions and indices of the rendered quad.
void resizeGL(int width, int height)
resizeGL handles resize events
QOpenGLVertexArrayObject vao
uniform int height
Definition: alpha.frag:20
QOpenGLShaderProgram * shader
void setOrientation(int ori)
setOrientation sets the orientation parameter for this rendering window.
void setRegion(float sep, QColor c1, QColor c2)
setRegion sets the transfer function parameters for this rendering window.
QOpenGLBuffer indices
void setShader(const std::string &vert, const std::string &frag)
setShader sets the shader to be used for rendering.
QOpenGLDebugLogger * logger
GLRenderWidget(QWidget *parent)
QOpenGLBuffer vbo
uniform int width
Definition: alpha.frag:19
The GLRenderWidget class implementing additional OpenGL capabilities on a QWidget.
RenderData objectData
void initializeGL()
initializeGL performs openGL setup.
Helper struct for passing renderable data in the application.
Definition: Renderable.h:17
void setVolumeTexture(QOpenGLTexture *volume3Dtex)
setVolumeTexture sets the volume that should be rendered in this window.
void paintGL()
paintGL passes unfiroms to shader program and renders volume into GUI window.