本文整理匯總了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)