00001 #ifndef OPENGLWIDGET_H_
00002 #define OPENGLWIDGET_H_
00003
00004 #include "common.h"
00005
00006 #include "./Ui_OpenGLWidget.h"
00007 #include "FlowData.h"
00008 #include "Texture.h"
00009 #include "Shader.h"
00010 #include "Arrows.h"
00011 #include "StreamLine.h"
00012
00013 #include <glew/glew.h>
00014 #include <il/il.h>
00015 #include <QGLWidget>
00016
00017 class OpenGLWidget : public QGLWidget, protected Ui_OpenGLWidget
00018 {
00019 Q_OBJECT
00020
00021
00022 public:
00023
00024 OpenGLWidget(QWidget* parent = 0, Qt::WFlags flags = 0);
00025
00026 virtual ~OpenGLWidget();
00027
00031 void initializeGL();
00032
00036 void resizeGL( int width, int height );
00037
00041 void paintGL();
00042
00046 void setFlowData(FlowData* data);
00047
00051 void setColorBarTexture(QGradientStops stops);
00052
00053 public slots:
00054
00055 void selectStreamLineColor();
00056
00057
00058 void selectStreamGlyphColor();
00059
00060
00061 void setStreamGlyphSize(int gs);
00062
00063
00064 void setStreamGlyphDistance(int gd);
00065
00066
00067 void updateStreamLines();
00068
00069
00070 void setEuler();
00071
00072
00073 void setRungeKutta();
00074
00075
00076 void setActiveBackground(int bg);
00077
00078
00079 void setActiveArrows(bool gl);
00080
00081 void setActiveTransferFunction(bool tf);
00082
00084 void resetDataView();
00085
00086
00087
00088
00089 void setDSep( int dSep );
00090 void setDTest( int dTest );
00091
00093 void setLinesActive( bool isActive );
00094 void setTaperingActive( bool isActive );
00095 void setGlyphActive( bool isActive );
00096
00097 signals:
00099 void setPointSize(int p);
00100 void setResolution(int r);
00101 void setActivePointScale(bool ps);
00102 void setArrowColor();
00103
00104
00105 protected:
00106
00107 void wheelEvent(QWheelEvent* we);
00108
00109
00110 void mousePressEvent(QMouseEvent* pe);
00111 void mouseMoveEvent(QMouseEvent* me);
00112 void mouseReleaseEvent(QMouseEvent* re);
00113
00114 private:
00115
00119 void drawBackground();
00120
00124 void setDataView(bool reset = false);
00125
00129 void initGlew();
00130
00134 void initDevIL();
00135
00137 void createStreamLines();
00138
00139
00140 private:
00141
00143 FlowData* m_flowData;
00144
00146 FlowGeometry* m_geomData;
00147
00149 Arrows* m_arrows;
00150
00152 StreamLine* m_streamLine;
00153
00155 bool m_librariesInitialised;
00156
00158 bool m_isFileOpen;
00159
00161 bool m_flippedAxes;
00162
00164 bool m_isActiveArrows;
00165
00167 QWidget* m_parent;
00168
00170 QColor m_clearColor;
00171
00173 GLuint m_dataDimX, m_dataDimY;
00174 GLuint m_windowWidth, m_windowHeight;
00175 float m_aspectRatio;
00176
00178 GLuint m_activeBackground;
00179 bool m_isActiveBackground;
00180
00182 bool m_isActiveStreamlines;
00183
00185 bool m_isActiveTransferFunction;
00186
00188 GLuint m_backgroundTexID[max_channels];
00189 GLuint m_colorBarTexID;
00190
00191 Shader* m_colorLookupShader;
00192
00194 GLint m_tfTextureLocation;
00195 GLint m_bgTextureLocation;
00196 GLint m_showTfLocation;
00197
00199 Qt::MouseButton m_panXButton;
00200 Qt::MouseButton m_panYButton;
00201
00203 OrthoViewT m_defaultOrtho;
00204
00206 OrthoViewT m_currentOrtho;
00207
00209 QPoint m_currentMousePos;
00210
00211 };
00212 #endif