本文整理汇总了Python中OpenGL.GL.glOrtho方法的典型用法代码示例。如果您正苦于以下问题:Python GL.glOrtho方法的具体用法?Python GL.glOrtho怎么用?Python GL.glOrtho使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.GL
的用法示例。
在下文中一共展示了GL.glOrtho方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_box
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glOrtho [as 别名]
def draw_box(self, x0, y0, x1, y1):
'''Draws a selection box in the 3-D window.
Coordinates are with respect to the lower left corner of the window.
'''
import OpenGL.GL as gl
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
gl.glOrtho(0.0, self.size[0],
0.0, self.size[1],
-0.01, 10.0)
gl.glLineStipple(1, 0xF00F)
gl.glEnable(gl.GL_LINE_STIPPLE)
gl.glLineWidth(1.0)
gl.glColor3f(1.0, 1.0, 1.0)
gl.glBegin(gl.GL_LINE_LOOP)
gl.glVertex3f(x0, y0, 0.0)
gl.glVertex3f(x1, y0, 0.0)
gl.glVertex3f(x1, y1, 0.0)
gl.glVertex3f(x0, y1, 0.0)
gl.glEnd()
gl.glDisable(gl.GL_LINE_STIPPLE)
gl.glFlush()
self.resize(*self.size)
示例2: resizeGL
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glOrtho [as 别名]
def resizeGL(self, width, height):
side = min(width, height)
GL.glViewport((width - side) // 2, (height - side) // 2, side, side)
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glLoadIdentity()
#GL.glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0)
GL.glFrustum(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0)
GL.glMatrixMode(GL.GL_MODELVIEW)
示例3: resize
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glOrtho [as 别名]
def resize(width,height):
gl.glViewport(0, 0, width, height+4)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
gl.glOrtho(0, width, 0, height+4, -1, 1)
gl.glMatrixMode(gl.GL_MODELVIEW)
示例4: setup_projection
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glOrtho [as 别名]
def setup_projection(self):
w, h = (0.5 * s / self.defaultScale
for s in self.size)
minx, maxx = - w, w
miny, maxy = - h, h
minz, maxz = -4000, 4000
GL.glOrtho(minx, maxx, miny, maxy, minz, maxz)
示例5: setup_projection
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glOrtho [as 别名]
def setup_projection(self):
GL.glOrtho(self.xmin, self.xmax, self.ymin, self.ymax,
self.near, self.far)
示例6: resizeGL
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import glOrtho [as 别名]
def resizeGL(self, width, height):
side = min(width, height)
GL.glViewport((width - side) / 2, (height - side) / 2, side, side)
GL.glMatrixMode(GL.GL_PROJECTION)
GL.glLoadIdentity()
GL.glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0)
GL.glMatrixMode(GL.GL_MODELVIEW)