diff options
Diffstat (limited to 'src/glview.cc')
-rw-r--r-- | src/glview.cc | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/src/glview.cc b/src/glview.cc index bd53b1b..6836e3b 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -27,6 +27,7 @@ #include "GLView.h" #include "Preferences.h" #include "renderer.h" +#include "rendersettings.h" #include <QApplication> #include <QWheelEvent> @@ -136,15 +137,26 @@ void GLView::initializeGL() fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err)); } + GLint rbits, gbits, bbits, abits, dbits, sbits; + glGetIntegerv(GL_RED_BITS, &rbits); + glGetIntegerv(GL_GREEN_BITS, &gbits); + glGetIntegerv(GL_BLUE_BITS, &bbits); + glGetIntegerv(GL_ALPHA_BITS, &abits); + glGetIntegerv(GL_DEPTH_BITS, &dbits); + glGetIntegerv(GL_STENCIL_BITS, &sbits); + + this->rendererInfo.sprintf("GLEW version %s\n" "OpenGL version %s\n" "%s (%s)\n\n" + "RGBA(%d%d%d%d), depth(%d), stencil(%d)\n" "Extensions:\n" "%s\n", glewGetString(GLEW_VERSION), glGetString(GL_RENDERER), glGetString(GL_VENDOR), glGetString(GL_VERSION), + rbits, gbits, bbits, abits, dbits, sbits, glGetString(GL_EXTENSIONS)); @@ -179,6 +191,28 @@ void GLView::initializeGL() } } if (opencsg_support && this->has_shaders) { + /* + Uniforms: + 1 color1 - face color + 2 color2 - edge color + 7 xscale + 8 yscale + + Attributes: + 3 trig + 4 pos_b + 5 pos_c + 6 mask + + Other: + 9 width + 10 height + + Outputs: + tp + tr + shading + */ const char *vs_source = "uniform float xscale, yscale;\n" "attribute vec3 pos_b, pos_c;\n" @@ -204,6 +238,11 @@ void GLView::initializeGL() " shading = abs(dot(normal, lightDir));\n" "}\n"; + /* + Inputs: + tp && tr - if any components of tp < tr, use color2 (edge color) + shading - multiplied by color1. color2 is is without lighting + */ const char *fs_source = "uniform vec4 color1, color2;\n" "varying vec3 tp, tr, tmp;\n" @@ -340,7 +379,7 @@ void GLView::paintGL() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR); + const QColor &bgcol = RenderSettings::inst()->color(RenderSettings::BACKGROUND_COLOR); glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -358,7 +397,7 @@ void GLView::paintGL() if (showcrosshairs) { glLineWidth(3); - const QColor &col = Preferences::inst()->color(Preferences::CROSSHAIR_COLOR); + const QColor &col = RenderSettings::inst()->color(RenderSettings::CROSSHAIR_COLOR); glColor3f(col.redF(), col.greenF(), col.blueF()); glBegin(GL_LINES); for (double xf = -1; xf <= +1; xf += 2) @@ -459,7 +498,7 @@ void GLView::paintGL() // FIXME: This was an attempt to keep contrast with background, but is suboptimal // (e.g. nearly invisible against a gray background). int r,g,b; - bgcol.getRgb(&r, &g, &b); +// bgcol.getRgb(&r, &g, &b); glColor3d((255.0-r)/255.0, (255.0-g)/255.0, (255.0-b)/255.0); glBegin(GL_LINES); // X Label |