-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenGL: Starting to break up legacy classes into their own pyx files.
- Loading branch information
1 parent
efdf727
commit 2aa8a9c
Showing
3 changed files
with
354 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class OpenGLOrthoWidget(OpenGLPerspectiveWidget): | ||
""" | ||
A version of the widget that uses orthographic projection instead | ||
of perspective. | ||
""" | ||
|
||
def build_projection(self, width, height, t=1.0): | ||
aspect = float(width)/float(height) | ||
top = self.fovy/2 | ||
right = top*aspect | ||
self.make_current() | ||
glMatrixMode(GL_PROJECTION) | ||
glLoadIdentity() | ||
if self.flipped: | ||
glEnable(GL_LIGHT1) | ||
glDisable(GL_LIGHT0) | ||
glOrtho(-right, right, top, -top, 3.0, -3.0) | ||
else: | ||
glEnable(GL_LIGHT0) | ||
glDisable(GL_LIGHT1) | ||
glOrtho(-right, right, -top, top, -3.0, 3.0) | ||
|
||
def tkTranslate(self, event): | ||
""" | ||
Perform translation of scene. | ||
""" | ||
self.redraw_if_initialized() | ||
self.tkRecordMouse(event) |
Oops, something went wrong.