00001 #ifndef GLWidget_H 00002 #define GLWidget_H 00003 00004 #include "GLView.h" 00005 #include "GL2DView.h" 00006 #include "GL3DView.h" 00007 #include "Volume.h" 00008 #include "ui_MainWindow.h" 00009 00010 #include <QGLWidget> 00011 00012 // Widget for 2D and 3D GL Widgets 00013 class GLWidget : public QGLWidget 00014 { 00015 Q_OBJECT 00016 00017 public: 00018 GLWidget(Ui_MainWindow uiMainWindow, QWidget *parent = 0); 00019 ~GLWidget(); 00020 00021 // QGLWidget 00022 void timerEvent(QTimerEvent *event); 00023 QSize minimumSizeHint() const; 00024 QSize sizeHint() const; 00025 void initializeGL(); 00026 void paintGL(); 00027 void resizeGL(int width, int height); 00028 void mousePressEvent(QMouseEvent *event); 00029 void mouseMoveEvent(QMouseEvent *event); 00030 void wheelEvent(QWheelEvent *event); 00031 00032 public slots: 00033 virtual void updateGL(); 00034 void changeVolume(Volume *volume); 00035 void changeTransferFunction(unsigned int *transferFunction, int length); 00036 00037 protected slots: 00038 void view2D(); 00039 void view3D(); 00040 void shaderChanged(QAction *qAction); 00041 00042 private: 00043 void switchView(GLView *newView); 00044 00045 bool updateAsked; 00046 int timerIdentifier; 00047 00048 int lastWidth, lastHeight; 00049 GLView *glCurrentView, *gl2DView, *gl3DView; 00050 VolumeDesc volumeDesc; 00051 TransferFunctionDesc transferFunctionDesc; 00052 StateDesc stateDesc; 00053 }; 00054 00055 #endif // GLWidget_H