Commit 12da0a83 authored by Guillaume Seguin's avatar Guillaume Seguin

Improve zeroing of Ortho/Perspective modes

parent 6da508a2
......@@ -88,10 +88,6 @@ class GcodeViewPanel(wxGLPanel):
self.create_objects()
glPushMatrix()
if self.orthographic:
glTranslatef(0, 0, -3 * self.dist) # Move back
else:
glTranslatef(0, 0, -self.dist) # Move back
# Rotate according to trackball
glMultMatrixd(build_rotmatrix(self.basequat))
# Move origin to bottom left of platform
......
......@@ -23,7 +23,7 @@ pyglet.options['debug_gl'] = True
from pyglet.gl import *
from pyglet import gl
from .trackball import trackball, mulquat
from .trackball import trackball, mulquat, build_rotmatrix
class wxGLPanel(wx.Panel):
'''A simple class for using OpenGL with wxPython.'''
......@@ -119,9 +119,11 @@ class wxGLPanel(wx.Panel):
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
if self.orthographic:
glOrtho(-width / 2, width / 2, -height / 2, height / 2, 0.1, 5 * self.dist)
glOrtho(-width / 2, width / 2, -height / 2, height / 2,
-5 * self.dist, 5 * self.dist)
else:
gluPerspective(60., float(width) / height, 10.0, 3 * self.dist)
glTranslatef(0, 0, -self.dist) # Move back
glMatrixMode(GL_MODELVIEW)
if not self.mview_initialized:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment