diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glview.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/glview.cc b/src/glview.cc index 3a4218a..f2bc282 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -228,15 +228,12 @@ void GLView::resizeGL(int w, int h) #endif glViewport(0, 0, w, h); w_h_ratio = sqrt((double)w / (double)h); + + setupPerspective(); } -void GLView::paintGL() +void GLView::setupPerspective() { - const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR); - glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); glLoadIdentity(); if (orthomode) @@ -245,6 +242,15 @@ void GLView::paintGL() -FAR_FAR_AWAY, +FAR_FAR_AWAY); else glFrustum(-w_h_ratio, +w_h_ratio, -(1/w_h_ratio), +(1/w_h_ratio), +10.0, +FAR_FAR_AWAY); +} + +void GLView::paintGL() +{ + const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR); + glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + gluLookAt(0.0, -viewer_distance, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0); glMatrixMode(GL_MODELVIEW); @@ -374,6 +380,9 @@ void GLView::paintGL() glVertex3d(zlabel_x-3, zlabel_y+3, 0); glVertex3d(zlabel_x+3, zlabel_y+3, 0); glVertex3d(zlabel_x-3, zlabel_y-3, 0); glVertex3d(zlabel_x+3, zlabel_y+3, 0); glEnd(); + + //Restore perspective for next paint + setupPerspective(); } if (statusLabel) { |