<s> """<STR_LIT>""" <EOL> import time <EOL> import numpy as np <EOL> from vispy import gloo <EOL> from vispy import app <EOL> im1 = np . zeros ( ( <NUM_LIT:100> , <NUM_LIT:100> , <NUM_LIT:3> ) , '<STR_LIT>' ) <EOL> im1 [ : <NUM_LIT:50> , : , <NUM_LIT:0> ] = <NUM_LIT:1.0> <EOL> im1 [ : , : <NUM_LIT:50> , <NUM_LIT:1> ] = <NUM_LIT:1.0> <EOL> im1 [ <NUM_LIT:50> : , <NUM_LIT:50> : , <NUM_LIT:2> ] = <NUM_LIT:1.0> <EOL> vertex_data = np . zeros ( <NUM_LIT:4> , dtype = [ ( '<STR_LIT>' , np . float32 , <NUM_LIT:3> ) , <EOL> ( '<STR_LIT>' , np . float32 , <NUM_LIT:2> ) ] ) <EOL> vertex_data [ '<STR_LIT>' ] = np . array ( [ [ - <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0.0> ] , [ + <NUM_LIT> , - <NUM_LIT> , <NUM_LIT:0.0> ] , <EOL> [ - <NUM_LIT> , + <NUM_LIT> , <NUM_LIT:0.0> ] , [ + <NUM_LIT> , + <NUM_LIT> , <NUM_LIT:0.0> , ] ] ) <EOL> vertex_data [ '<STR_LIT>' ] = np . array ( [ [ <NUM_LIT:0.0> , <NUM_LIT:0.0> ] , [ <NUM_LIT:0.0> , <NUM_LIT:1.0> ] , <EOL> [ <NUM_LIT:1.0> , <NUM_LIT:0.0> ] , [ <NUM_LIT:1.0> , <NUM_LIT:1.0> ] ] ) <EOL> indices = np . array ( [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , np . uint16 ) <EOL> indices_buffer = gloo . IndexBuffer ( indices ) <EOL> client_indices_buffer = gloo . IndexBuffer ( indices ) <EOL> VERT_SHADER = """<STR_LIT>""" <EOL> FRAG_SHADER = """<STR_LIT>""" <EOL> class Canvas ( app . Canvas ) : <EOL> def __init__ ( self ) : <EOL> app . Canvas . __init__ ( self , keys = '<STR_LIT>' ) <EOL> self . _program = gloo . Program ( VERT_SHADER , FRAG_SHADER ) <EOL> self . _vbo = gloo . VertexBuffer ( vertex_data ) <EOL> self . _program [ '<STR_LIT>' ] = gloo . Texture2D ( im1 ) <EOL> self . _program . bind ( self . _vbo ) <EOL> gloo . set_clear_color ( '<STR_LIT>' ) <EOL> self . _timer = app . Timer ( '<STR_LIT>' , connect = self . update , start = True ) <EOL> self . show ( ) <EOL> def on_resize ( self , event ) : <EOL> width , height = event . physical_size <EOL> gloo . set_viewport ( <NUM_LIT:0> , <NUM_LIT:0> , width , height ) <EOL> def on_draw ( self , event ) : <EOL> gloo . clear ( ) <EOL> self . _program [ '<STR_LIT>' ] = <NUM_LIT:0.5> + np . sin ( time . time ( ) * <NUM_LIT:3> ) * <NUM_LIT> <EOL> self . _program . draw ( '<STR_LIT>' , indices_buffer ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> c = Canvas ( ) <EOL> app . run ( ) </s>
