當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。