summaryrefslogtreecommitdiff
path: root/src/glview.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/glview.cc')
-rw-r--r--src/glview.cc59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/glview.cc b/src/glview.cc
index 870a1c9..a7f3cd9 100644
--- a/src/glview.cc
+++ b/src/glview.cc
@@ -25,7 +25,8 @@
*/
#include "GLView.h"
-#include "Preferences.h"
+// FIXME: Reenable/rewrite - don't be dependant on GUI
+//#include "Preferences.h"
#include <QApplication>
#include <QWheelEvent>
@@ -39,35 +40,45 @@
GLView::GLView(QWidget *parent) : QGLWidget(parent)
{
- viewer_distance = 500;
- object_rot_x = 35;
- object_rot_y = 0;
- object_rot_z = 25;
- object_trans_x = 0;
- object_trans_y = 0;
- object_trans_z = 0;
+ init();
+}
- mouse_drag_active = false;
- last_mouse_x = 0;
- last_mouse_y = 0;
+GLView::GLView(const QGLFormat & format, QWidget *parent) : QGLWidget(format, parent)
+{
+ init();
+}
- orthomode = false;
- showaxes = false;
- showcrosshairs = false;
+void GLView::init()
+{
+ this->viewer_distance = 500;
+ this->object_rot_x = 35;
+ this->object_rot_y = 0;
+ this->object_rot_z = 25;
+ this->object_trans_x = 0;
+ this->object_trans_y = 0;
+ this->object_trans_z = 0;
+
+ this->mouse_drag_active = false;
+ this->last_mouse_x = 0;
+ this->last_mouse_y = 0;
- renderfunc = NULL;
- renderfunc_vp = NULL;
+ this->orthomode = false;
+ this->showaxes = false;
+ this->showcrosshairs = false;
+
+ this->renderfunc = NULL;
+ this->renderfunc_vp = NULL;
for (int i = 0; i < 10; i++)
- shaderinfo[i] = 0;
+ this->shaderinfo[i] = 0;
- statusLabel = NULL;
+ this->statusLabel = NULL;
setMouseTracking(true);
#ifdef ENABLE_OPENCSG
- opencsg_support = true;
+ this->opencsg_support = true;
static int sId = 0;
- opencsg_id = sId++;
+ this->opencsg_id = sId++;
#endif
}
@@ -216,7 +227,9 @@ void GLView::resizeGL(int w, int h)
void GLView::paintGL()
{
- const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR);
+// FIXME: Reenable/rewrite - don't be dependant on GUI
+// const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR);
+ const QColor &bgcol = QColor(0xff, 0xff, 0xe5);
glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -259,7 +272,8 @@ void GLView::paintGL()
if (showcrosshairs)
{
glLineWidth(3);
- const QColor &col = Preferences::inst()->color(Preferences::CROSSHAIR_COLOR);
+// const QColor &col = Preferences::inst()->color(Preferences::CROSSHAIR_COLOR);
+ const QColor &col = QColor(0x80, 0x00, 0x00);
glColor3f(col.redF(), col.greenF(), col.blueF());
glBegin(GL_LINES);
for (double xf = -1; xf <= +1; xf += 2)
@@ -510,4 +524,3 @@ void GLView::mouseReleaseEvent(QMouseEvent*)
mouse_drag_active = false;
releaseMouse();
}
-
contact: Jan Huwald // Impressum