当前位置: 首页>>代码示例>>Python>>正文


Python Matrix.ortho方法代码示例

本文整理汇总了Python中Matrix.Matrix.ortho方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.ortho方法的具体用法?Python Matrix.ortho怎么用?Python Matrix.ortho使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix.Matrix的用法示例。


在下文中一共展示了Matrix.ortho方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: from Matrix import Matrix [as 别名]
# 或者: from Matrix.Matrix import ortho [as 别名]
   def init(self):
      # Initialize the renderer, set up the Window.
      glfw.init()
      glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3)
      glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 3)
      glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, gl.GL_TRUE)
      glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
      glfw.window_hint(glfw.DECORATED, gl.GL_TRUE)
      glfw.window_hint(glfw.DECORATED, gl.GL_TRUE)
      glfw.window_hint(glfw.RESIZABLE, gl.GL_FALSE)

      width = Config.windowWidth
      height = Config.windowHeight

      self.aspect = width/height

      # Initialize the window
      self.window = glfw.create_window(width, height, "Magic", None, None)
      glfw.make_context_current(self.window)
      self.renderer = Renderer()
      self.quad = []
      self.text = []

      # Set up camera
      self.viewMatrix = Matrix.identity()

      # Set up view transform. View is always 16 units high, and 16 * aspect units
      # wide. The extra space outside of a 4:3 ratio is unused, to make sure that
      # all the cards always fit in a 4:3 aspect monitor. 
      vHeight = 2
      vWidth = vHeight * self.aspect
      self.projectionMatrix = Matrix.ortho(-vWidth/2, vWidth/2, vHeight/2, -vHeight/2, -1, 1)
      self.viewProjectionMatrix = self.projectionMatrix * self.viewMatrix

      # Set up viewport
      fbWidth, fbHeight = glfw.get_framebuffer_size(self.window)
      gl.glViewport(0, 0, fbWidth, fbHeight)
      q = Quad(Texture('Images/Sen Triplets.jpg'))
      # Natural resolution of cards is 480x680
      cardAspect = 480/680
      q.x = 0
      q.y = 0
      q.height = .8
      q.width = q.height * cardAspect
      self.quad.append(q)
开发者ID:heavyairship,项目名称:Magic,代码行数:47,代码来源:Context.py


注:本文中的Matrix.Matrix.ortho方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。