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


Python GLU.gluPerspective方法代码示例

本文整理汇总了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) 
开发者ID:spectralpython,项目名称:spectral,代码行数:26,代码来源:hypercube.py

示例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() 
开发者ID:spectralpython,项目名称:spectral,代码行数:14,代码来源:hypercube.py

示例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() 
开发者ID:spectralpython,项目名称:spectral,代码行数:15,代码来源:ndwindow.py

示例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) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:7,代码来源:camera.py

示例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) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:5,代码来源:openglwidgets.py

示例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) 
开发者ID:maweigert,项目名称:spimagine,代码行数:12,代码来源:basic_window.py

示例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) 
开发者ID:Oslandia,项目名称:albion,代码行数:9,代码来源:viewer_3d.py


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