Example #1
0
def _test_functionality(backend):
    """Create app and canvas so we have a context. Then run tests."""
    # use the backend
    gl.use_gl(backend)

    with Canvas() as canvas:
        _clear_screen()

        # Prepare
        w, h = canvas.size
        gl.glViewport(0, 0, w, h)
        gl.glScissor(0, 0, w, h)  # touch
        gl.glClearColor(0.0, 0.0, 0.0, 1.0)

        # Setup visualization, ensure to do it in a draw event
        objects = _prepare_vis()
        _clear_screen()
        _draw1()
        _clear_screen()
        _draw2()
        _clear_screen()
        _draw3()

        # Clean up
        for delete_func, handle in objects:
            delete_func(handle)
        gl.glFinish()
Example #2
0
def _test_functonality(backend):
    """ Create app and canvas so we have a context. Then run tests.
    """
    # use the backend
    gl.use_gl(backend)
    
    with Canvas() as canvas:
        _clear_screen()
        
        # Prepare
        w, h = canvas.size
        gl.glViewport(0, 0, w, h)
        gl.glScissor(0, 0, w, h)  # touch
        gl.glClearColor(0.0, 0.0, 0.0, 1.0)
        
        # Setup visualization, ensure to do it in a draw event
        objects = _prepare_vis()
        _clear_screen()
        _draw1()
        _clear_screen()
        _draw2()
        _clear_screen()
        _draw3()

        # Clean up
        for delete_func, handle in objects:
            delete_func(handle)
        gl.glFinish()
Example #3
0
def _test_functonality(backend):
    """ Create app and canvas so we have a context. Then run tests.
    """

    # use the backend
    gl.use(backend)
    
    # Note that we explicitly use pyglet because with Qt we seem
    # to get errors for this test
    
    with app_opengl_context('qt') as context:
        
        _clear_screen()
        
        # Prepare
        w, h = context.c.size
        gl.glViewport(0, 0, w, h)
        gl.glScissor(0, 0, w, h)  # touch
        gl.glClearColor(0.0, 0.0, 0.0, 1.0)
        
        # Setup visualization, ensure to do it in a paint event
        objects = context.test(_prepare_vis)
        
        _clear_screen()
        
        # Draw 1
        context.test(_draw1)
        if SHOW:
            context.c.swap_buffers()
            app.process_events()
            time.sleep(1.0)
        
        _clear_screen()
        
        # Draw 2
        context.test(_draw2)
        if SHOW:
            context.c.swap_buffers()
            app.process_events()
            time.sleep(1.0)
        
        _clear_screen()
        
        # Draw 3
        context.test(_draw3)
        if SHOW:
            context.c.swap_buffers()
            app.process_events()
            time.sleep(1.0)
        
        # Clean up
        for delete_func, handle in objects:
            delete_func(handle)