summaryrefslogtreecommitdiff
path: root/glview.cc
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-15 13:03:42 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-15 13:03:42 (GMT)
commit4c53f4ec2281b0aeff77ec1bbd91daf6890fbce0 (patch)
treeae4e6d53a49ebe2e4b4b340b94571e630ec7a0fd /glview.cc
parent4e3548fe03cc6ac78381e556d5e8da753759b510 (diff)
Added CROSSHAIR_COLOR, refactored parts of the public GLView interface
git-svn-id: http://svn.clifford.at/openscad/trunk@313 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'glview.cc')
-rw-r--r--glview.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/glview.cc b/glview.cc
index 45727cf..18260f8 100644
--- a/glview.cc
+++ b/glview.cc
@@ -20,6 +20,7 @@
#include "openscad.h"
#include "GLView.h"
+#include "Preferences.h"
#include <QApplication>
#include <QWheelEvent>
@@ -61,7 +62,11 @@ GLView::GLView(QWidget *parent) : QGLWidget(parent)
#endif
}
-extern GLint e1, e2, e3;
+void GLView::setRenderFunc(void (*func)(void*), void *userdata)
+{
+ this->renderfunc = func;
+ this->renderfunc_vp = userdata;
+}
void GLView::initializeGL()
{
@@ -71,7 +76,8 @@ void GLView::initializeGL()
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glClearColor(1.0, 1.0, 0.9, 0.0);
+ const QColor &col = Preferences::inst()->color(Preferences::BACKGROUND_COLOR);
+ glClearColor(col.redF(), col.greenF(), col.blueF(), 0.0);
#ifdef ENABLE_OPENCSG
GLenum err = glewInit();
@@ -234,7 +240,8 @@ void GLView::paintGL()
if (showcrosshairs)
{
glLineWidth(3);
- glColor3d(0.5, 0.0, 0.0);
+ const QColor &col = Preferences::inst()->color(Preferences::CROSSHAIR_COLOR);
+ glColor3f(col.redF(), col.greenF(), col.blueF());
glBegin(GL_LINES);
for (double xf = -1; xf <= +1; xf += 2)
for (double yf = -1; yf <= +1; yf += 2) {
@@ -247,6 +254,7 @@ void GLView::paintGL()
glTranslated(object_trans_x, object_trans_y, object_trans_z);
+ // Large gray axis cross inline with the model
if (showaxes)
{
glLineWidth(1);
@@ -271,6 +279,8 @@ void GLView::paintGL()
if (renderfunc)
renderfunc(renderfunc_vp);
+ // Small axis cross in the lower left corner
+ // FIXME: Adjust color to keep contrast with background
if (showaxes)
{
glDepthFunc(GL_ALWAYS);
@@ -290,10 +300,12 @@ void GLView::paintGL()
glRotated(object_rot_z, 0.0, 0.0, 1.0);
glLineWidth(1);
- glColor3d(0.0, 0.0, 1.0);
glBegin(GL_LINES);
+ glColor3d(1.0, 0.0, 0.0);
glVertex3d(0, 0, 0); glVertex3d(10, 0, 0);
+ glColor3d(0.0, 1.0, 0.0);
glVertex3d(0, 0, 0); glVertex3d(0, 10, 0);
+ glColor3d(0.0, 0.0, 1.0);
glVertex3d(0, 0, 0); glVertex3d(0, 0, 10);
glEnd();
@@ -326,6 +338,7 @@ void GLView::paintGL()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
+ // FIXME: Adjust color to keep contrast with background
glColor3d(0.0, 0.0, 0.0);
glBegin(GL_LINES);
// X Label
contact: Jan Huwald // Impressum