Пример #1
0
 def OnInit( self ):
     """Load the image on initial load of the application"""
     self.texture = imagetexture.ImageTexture( url = ["nehe_wall.bmp"] )
     self.addEventHandler( 'keypress', name='c', function=self.OnCaptureColour )
     self.addEventHandler( 'keypress', name='d', function=self.OnCaptureDepth )
     self.addEventHandler( 'keypress', name='v', function=self.OnViewCapture )
     self.addEventHandler( 'keypress', name='s', function=self.OnSave )
     self.addEventHandler( 'keypress', name='t', function=self.OnUseStringDraw )
     self.addEventHandler( 'keypress', name='r', function=self.OnCapture1Colour )
     self.addEventHandler( 'keypress', name='g', function=self.OnCapture1Colour )
     self.addEventHandler( 'keypress', name='b', function=self.OnCapture1Colour )
     self.addEventHandler( 'keypress', name='u', function=self.OnTypedFunction )
     
     usage = """		s -- save the captured buffer to the file test.jpg'
     c -- capture the colour buffer 
     r,g,b -- capture red/green/blue channels independently
     d -- capture the depth buffer 
     v -- view the captured buffer 
     s -- save the captured buffer to file test.jpg 
     t -- use the "string" version of the glDrawPixels function 
     u -- use the "ub" variant of the base glReadPixels function
     """
     print usage
     self.getViewPlatform().setFrustum( near = 3, far = 10 )
     print self.getViewPlatform().frustum
     print 'Current depth scale', glGetDouble( GL_DEPTH_SCALE )
     print 'Current depth bias', glGetDouble( GL_DEPTH_BIAS )
Пример #2
0
 def OnInit(self):
     """Load the image on initial load of the application"""
     self.texture = imagetexture.ImageTexture(url=["nehe_wall.bmp"])
     print('Press <f> to switch to full-screen mode')
     self.addEventHandler('keypress',
                          name='f',
                          function=self.OnFullScreenToggle)
     self.addEventHandler('keyboard',
                          name='<escape>',
                          function=self.OnEscape)
     self.returnValues = None
Пример #3
0
    def OnInit(self):
        """Scene set up and initial processing"""
        haveExtension = bool(glGenQueries)
        if not haveExtension:
            log.error('OpenGL 1.5/GL_ARB_occlusion_query not supported!')
            sys.exit(testingcontext.REQUIRED_EXTENSION_MISSING)

        log.info("""When the box is offscreen number of pixels should drop to 0
""")
        log.info('press i to choose another texture for the box')
        self.addEventHandler('keypress', name='i', function=self.OnImageSwitch)
        log.info('press s to choose another size for the box')
        self.addEventHandler('keypress', name='s', function=self.OnSizeSwitch)
        self.shape = shape.Shape(
            geometry=box.Box(size=sizes[0]),
            appearance=appearance.Appearance(
                material=material.Material(diffuseColor=(1, 1, 1)),
                texture=imagetexture.ImageTexture(url=[images[0]]),
            ),
        )