peng3d/window.py
def set3d(self,cam):
        """
        Configures OpenGL to draw in 3D.
        
        This method also applies the correct rotation and translation as set in the supplied camera ``cam``\ .
        It is discouraged to use :py:func:`glTranslatef()` or :py:func:`glRotatef()` directly as this may cause visual glitches.
        
        If you need to configure any of the standard parameters, see the docs about :doc:`/configoption`\ .
        
        The :confval:`graphics.wireframe` config value can be used to enable a wireframe mode, useful for debugging visual glitches.
        """
        if not isinstance(cam,camera.Camera):
            raise TypeError("cam is not of type Camera!")
        
        # Light
        
        #glEnable(GL_LIGHTING)
        
        if self.cfg["graphics.wireframe"]:
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
        
        width, height = self.get_size()
        glEnable(GL_DEPTH_TEST)
        glViewport(0, 0, width, height)
        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        gluPerspective(self.cfg["graphics.fieldofview"], width / float(height), self.cfg["graphics.nearclip"], self.cfg["graphics.farclip"]) # default 60
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        x, y = cam.rot
        glRotatef(x, 0, 1, 0)
        glRotatef(-y, math.cos(math.radians(x)), 0, math.sin(math.radians(x)))
        x, y, z = cam.pos
        glTranslatef(-x, -y, -z)
def set3d(self,cam):
        """
        Configures OpenGL to draw in 3D.
        
        This method also applies the correct rotation and translation as set in the supplied camera ``cam``\ .
        It is discouraged to use :py:func:`glTranslatef()` or :py:func:`glRotatef()` directly as this may cause visual glitches.
        
        If you need to configure any of the standard parameters, see the docs about :doc:`/configoption`\ .
        
        The :confval:`graphics.wireframe` config value can be used to enable a wireframe mode, useful for debugging visual glitches.
        """
        if not isinstance(cam,camera.Camera):
            raise TypeError("cam is not of type Camera!")
        
        # Light
        
        #glEnable(GL_LIGHTING)
        
        if self.cfg["graphics.wireframe"]:
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
        
        width, height = self.get_size()
        glEnable(GL_DEPTH_TEST)
        glViewport(0, 0, width, height)
        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        gluPerspective(self.cfg["graphics.fieldofview"], width / float(height), self.cfg["graphics.nearclip"], self.cfg["graphics.farclip"]) # default 60
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        x, y = cam.rot
        glRotatef(x, 0, 1, 0)
        glRotatef(-y, math.cos(math.radians(x)), 0, math.sin(math.radians(x)))
        x, y, z = cam.pos
        glTranslatef(-x, -y, -z)
def set3d ( self , cam ) : if not isinstance ( cam , camera . Camera ) : raise TypeError ( "cam is not of type Camera!" ) # Light #glEnable(GL_LIGHTING) if self . cfg [ "graphics.wireframe" ] : glPolygonMode ( GL_FRONT_AND_BACK , GL_LINE ) width , height = self . get_size ( ) glEnable ( GL_DEPTH_TEST ) glViewport ( 0 , 0 , width , height ) glMatrixMode ( GL_PROJECTION ) glLoadIdentity ( ) gluPerspective ( self . cfg [ "graphics.fieldofview" ] , width / float ( height ) , self . cfg [ "graphics.nearclip" ] , self . cfg [ "graphics.farclip" ] ) # default 60 glMatrixMode ( GL_MODELVIEW ) glLoadIdentity ( ) x , y = cam . rot glRotatef ( x , 0 , 1 , 0 ) glRotatef ( - y , math . cos ( math . radians ( x ) ) , 0 , math . sin ( math . radians ( x ) ) ) x , y , z = cam . pos glTranslatef ( - x , - y , - z )
Configures OpenGL to draw in 3D.
        
        This method also applies the correct rotation and translation as set in the supplied camera ``cam``\ .
        It is discouraged to use :py:func:`glTranslatef()` or :py:func:`glRotatef()` directly as this may cause visual glitches.
        
        If you need to configure any of the standard parameters, see the docs about :doc:`/configoption`\ .
        
        The :confval:`graphics.wireframe` config value can be used to enable a wireframe mode, useful for debugging visual glitches.
Configures OpenGL to draw in 3D . This method also applies the correct rotation and translation as set in the supplied camera cam \ . It is discouraged to use : py : func : glTranslatef () or : py : func : glRotatef () directly as this may cause visual glitches . If you need to configure any of the standard parameters see the docs about : doc : / configoption \ . The : confval : graphics . wireframe config value can be used to enable a wireframe mode useful for debugging visual glitches .