本文整理汇总了Python中OpenGL.GLU.gluPerspective方法的典型用法代码示例。如果您正苦于以下问题:Python GLU.gluPerspective方法的具体用法?Python GLU.gluPerspective怎么用?Python GLU.gluPerspective使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenGL.GLU
的用法示例。
在下文中一共展示了GLU.gluPerspective方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initgl
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def initgl(self):
"""Initialize OpenGL for use in the window."""
import OpenGL.GL as gl
import OpenGL.GLU as glu
self.load_textures()
gl.glEnable(gl.GL_TEXTURE_2D)
gl.glClearColor(*self.clear_color)
gl.glClearDepth(1.0)
gl.glDepthFunc(gl.GL_LESS)
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glShadeModel(gl.GL_SMOOTH)
gl.glMatrixMode(gl.GL_PROJECTION)
# Reset The projection matrix
gl.glLoadIdentity()
# Calculate aspect ratio of the window
(width, height) = self.canvas.GetClientSize()
glu.gluPerspective(45.0, float(width) / float(height), 0.1, 100.0)
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLightfv(gl.GL_LIGHT0, gl.GL_AMBIENT, (0.5, 0.5, 0.5, 1.0))
gl.glLightfv(gl.GL_LIGHT0, gl.GL_DIFFUSE, (1.0, 1.0, 1.0, 1.0))
gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, (0.0, 0.0, 2.0, 1.0))
gl.glEnable(gl.GL_LIGHT0)
示例2: resize
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def resize(self, width, height):
"""Reshape the OpenGL viewport based on dimensions of the window."""
import OpenGL.GL as gl
import OpenGL.GLU as glu
self.size = (width, height)
gl.glViewport(0, 0, width, height)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
glu.gluPerspective(self.fovy, float(width) / height,
self.znear, self.zfar)
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
示例3: resize
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def resize(self, width, height):
"""Reshape the OpenGL viewport based on dimensions of the window."""
import OpenGL.GL as gl
import OpenGL.GLU as glu
self.size = (width, height)
gl.glViewport(0, 0, width, height)
gl.glMatrixMode(gl.GL_PROJECTION)
gl.glLoadIdentity()
glu.gluPerspective(self.fovy, float(width) / height,
self.znear, self.zfar)
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
示例4: setup_projection
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def setup_projection(self):
distance = 1.0
if self.editor.renderer.inSpace():
distance = 8.0
GLU.gluPerspective(max(self.fov, 25.0), self.ratio, self.near * distance, self.far * distance)
示例5: setup_projection
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def setup_projection(self):
aspect = self.width / self.height
GLU.gluPerspective(self.fovy, aspect, self.near, self.far)
示例6: resizeGL
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def resizeGL(self, width, height):
if height == 0: height = 1
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
aspect = width / float(height)
GLU.gluPerspective(45.0, aspect, 1.0, 100.0)
glMatrixMode(GL_MODELVIEW)
示例7: resizeGL
# 需要导入模块: from OpenGL import GLU [as 别名]
# 或者: from OpenGL.GLU import gluPerspective [as 别名]
def resizeGL(self, width, height):
height = 1 if not height else height
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
GLU.gluPerspective(45.0, float(width) / height, 100, 100000)
glMatrixMode(GL_MODELVIEW)