Ejemplo n.º 1
0
 def ortho_perspective(self):
     if self.perspective == PERSPECTIVE_ORTHO:
         return
     self.display_aspect = 16 / 9.0
     self.ortho_pscalex = (
         2.0
         / self.display_width
         * (self.display_width / self.display_height)
     )
     self.ortho_pscaley = 2.0 / self.display_height
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glLoadIdentity()
     left = self.offset_x - 1.0 * self.display_aspect / self.zoom
     right = self.offset_x + 1.0 * self.display_aspect / self.zoom
     top = self.offset_y + 1.0 / self.zoom
     bottom = self.offset_y - 1.0 / self.zoom
     gl.glOrtho(left, right, bottom, top, -1.0, 1.0)
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glLoadIdentity()
     self.gl_left = -1.0 * self.display_aspect
     self.gl_right = 1.0 * self.display_aspect
     self.gl_height = 2.0  # * cls.display_aspect
     self.gl_width = 2.0 * self.display_aspect
     self.perspective = PERSPECTIVE_ORTHO
     return self.ortho_pscalex, self.ortho_pscaley
Ejemplo n.º 2
0
 def ortho_perspective(self):
     if self.perspective == PERSPECTIVE_ORTHO:
         return
     self.display_aspect = 16 / 9.0
     self.ortho_pscalex = (
         2.0
         / self.display_width
         * (self.display_width / self.display_height)
     )
     self.ortho_pscaley = 2.0 / self.display_height
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glLoadIdentity()
     left = self.offset_x - 1.0 * self.display_aspect / self.zoom
     right = self.offset_x + 1.0 * self.display_aspect / self.zoom
     top = self.offset_y + 1.0 / self.zoom
     bottom = self.offset_y - 1.0 / self.zoom
     gl.glOrtho(left, right, bottom, top, -1.0, 1.0)
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glLoadIdentity()
     self.gl_left = -1.0 * self.display_aspect
     self.gl_right = 1.0 * self.display_aspect
     self.gl_height = 2.0  # * cls.display_aspect
     self.gl_width = 2.0 * self.display_aspect
     self.perspective = PERSPECTIVE_ORTHO
     return self.ortho_pscalex, self.ortho_pscaley
Ejemplo n.º 3
0
 def hd_perspective(self):
     if self.perspective == PERSPECTIVE_HD:
         return
     self.display_aspect = 16 / 9.0
     self.ortho_pscalex = 1920 / self.display_width
     # cls.ortho_pscalex = 1920 / cls.display_width * \
     #         (cls.display_width / cls.display_height)
     self.ortho_pscaley = 1080 / self.display_height
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glLoadIdentity()
     left = 0.0
     right = 1920.0
     top = 1080.0
     bottom = 0.0
     gl.glOrtho(left, right, bottom, top, -1.0, 1.0)
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glLoadIdentity()
     self.gl_left = left
     self.gl_right = right
     self.gl_height = 1080.0
     self.gl_width = 1920.0
     self.perspective = PERSPECTIVE_HD
     return self.ortho_pscalex, self.ortho_pscaley
Ejemplo n.º 4
0
 def hd_perspective(self):
     if self.perspective == PERSPECTIVE_HD:
         return
     self.display_aspect = 16 / 9.0
     self.ortho_pscalex = 1920 / self.display_width
     # cls.ortho_pscalex = 1920 / cls.display_width * \
     #         (cls.display_width / cls.display_height)
     self.ortho_pscaley = 1080 / self.display_height
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glLoadIdentity()
     left = 0.0
     right = 1920.0
     top = 1080.0
     bottom = 0.0
     gl.glOrtho(left, right, bottom, top, -1.0, 1.0)
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glLoadIdentity()
     self.gl_left = left
     self.gl_right = right
     self.gl_height = 1080.0
     self.gl_width = 1920.0
     self.perspective = PERSPECTIVE_HD
     return self.ortho_pscalex, self.ortho_pscaley