Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
qtplainwidget.hpp
Go to the documentation of this file.
1 
23 #ifndef __QTPLAINWIDGET__
24 #define __QTPLAINWIDGET__
25 
26 #include <GL/glew.h>
27 
28 #include <QGLWidget>
29 #include <QMouseEvent>
30 #include <iostream>
31 
32 #include <tucano.hpp>
33 
34 using namespace std;
35 
36 namespace Tucano
37 {
38 
45 class QtPlainWidget : public QGLWidget
46 {
47  Q_OBJECT
48 
49 protected:
50 
51 public:
52 
53  explicit QtPlainWidget(QWidget *parent) : QGLWidget(parent)
54  {
55  }
56 
57  virtual ~QtPlainWidget()
58  {
59  }
60 
64  virtual void initializeGL (void)
65  {
66  makeCurrent();
67 
68  #ifdef TUCANODEBUG
69  QGLFormat glCurrentFormat = this->format();
70  cout << "set version : " << glCurrentFormat.majorVersion() << " , " << glCurrentFormat.minorVersion() << endl;
71  cout << "set profile : " << glCurrentFormat.profile() << endl;
72  #endif
73 
75 
76  }
77 
81  virtual void resizeGL (void)
82  {
83  updateGL();
84  }
85 
86 
87 protected:
88 
93  void keyPressEvent (QKeyEvent * event)
94  {
95  event->ignore();
96  updateGL();
97  }
98 
99 
100 
101 
102 signals:
103 
104 public slots:
105 
106 };
107 
108 }
109 #endif
Definition: bufferobject.hpp:34
A plain QtWidget.
Definition: qtplainwidget.hpp:45
virtual ~QtPlainWidget()
Definition: qtplainwidget.hpp:57
void keyPressEvent(QKeyEvent *event)
Callback for key press event.
Definition: qtplainwidget.hpp:93
virtual void initializeGL(void)
Initializes openGL and GLEW.
Definition: qtplainwidget.hpp:64
QtPlainWidget(QWidget *parent)
Definition: qtplainwidget.hpp:53
virtual void resizeGL(void)
Resize callback for the widget.
Definition: qtplainwidget.hpp:81
void initGlew(void)
Initialize Glew.
Definition: misc.hpp:68