summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2009-12-09 14:23:22 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2009-12-09 14:23:22 (GMT)
commitc8baf2b227a23b1361a4fa160ef1c183ef24f431 (patch)
tree86db0274562d87b451dc81a11d9ac3fe1b95e8e9
parente7f0df6313dcbc212bfbfc776c236c9d054e37ff (diff)
Extracted GLView.h from openscad.h
git-svn-id: http://svn.clifford.at/openscad/trunk@154 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--GLView.h66
-rw-r--r--glview.cc4
2 files changed, 69 insertions, 1 deletions
diff --git a/GLView.h b/GLView.h
new file mode 100644
index 0000000..ca269ce
--- /dev/null
+++ b/GLView.h
@@ -0,0 +1,66 @@
+#ifndef GLVIEW_H_
+#define GLVIEW_H_
+
+#ifdef ENABLE_OPENCSG
+// this must be included before the GL headers
+# include <GL/glew.h>
+#endif
+
+#include <QGLWidget>
+#include <QLabel>
+
+class GLView : public QGLWidget
+{
+ Q_OBJECT
+
+public:
+ void (*renderfunc)(void*);
+ void *renderfunc_vp;
+
+ bool orthomode;
+ bool showaxes;
+ bool showcrosshairs;
+
+ double viewer_distance;
+ double object_rot_x;
+ double object_rot_y;
+ double object_rot_z;
+ double object_trans_x;
+ double object_trans_y;
+ double object_trans_z;
+
+ double w_h_ratio;
+ GLint shaderinfo[11];
+
+ QLabel *statusLabel;
+#ifdef ENABLE_OPENCSG
+ bool opencsg_support;
+#endif
+
+ GLView(QWidget *parent = NULL);
+
+protected:
+ bool mouse_drag_active;
+ int last_mouse_x;
+ int last_mouse_y;
+
+ void keyPressEvent(QKeyEvent *event);
+ void wheelEvent(QWheelEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+
+ void initializeGL();
+ void resizeGL(int w, int h);
+ void paintGL();
+
+#ifdef ENABLE_OPENCSG
+private slots:
+ void display_opengl20_warning();
+#endif
+
+signals:
+ void doAnimateUpdate();
+};
+
+#endif
diff --git a/glview.cc b/glview.cc
index 882daf8..800b704 100644
--- a/glview.cc
+++ b/glview.cc
@@ -19,11 +19,13 @@
*/
#include "openscad.h"
+#include "GLView.h"
#include <QApplication>
#include <QWheelEvent>
#include <QMouseEvent>
#include <QMessageBox>
+#include <QTimer>
#define FAR_FAR_AWAY 100000.0
@@ -459,7 +461,7 @@ void GLView::mouseMoveEvent(QMouseEvent *event)
object_trans_z += tm[11];
}
updateGL();
- doAnimateUpdate();
+ emit doAnimateUpdate();
}
last_mouse_x = this_mouse_x;
last_mouse_y = this_mouse_y;
contact: Jan Huwald // Impressum