<s> '''<STR_LIT>''' <EOL> __noninteractive = True <EOL> import unittest <EOL> import pyglet <EOL> from pyglet . gl import * <EOL> class TEST_CASE ( unittest . TestCase ) : <EOL> def test_multitexture ( self ) : <EOL> window = pyglet . window . Window ( width = <NUM_LIT:64> , height = <NUM_LIT:64> ) <EOL> window . dispatch_events ( ) <EOL> w = window . width <EOL> h = window . height <EOL> pattern0 = pyglet . image . CheckerImagePattern ( <EOL> ( <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:0> , <NUM_LIT:255> ) , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:255> ) ) <EOL> texture0 = pattern0 . create_image ( <NUM_LIT:64> , <NUM_LIT:64> ) . get_texture ( ) <EOL> pattern1 = pyglet . image . CheckerImagePattern ( <EOL> ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:255> ) , ( <NUM_LIT:255> , <NUM_LIT:255> , <NUM_LIT:0> , <NUM_LIT:255> ) ) <EOL> texture1 = pattern1 . create_image ( <NUM_LIT:64> , <NUM_LIT:64> ) . get_texture ( ) <EOL> batch = pyglet . graphics . Batch ( ) <EOL> batch . add ( <NUM_LIT:4> , GL_QUADS , None , <EOL> ( '<STR_LIT>' , [ <NUM_LIT:0> , <NUM_LIT:0> , w , <NUM_LIT:0> , w , h , <NUM_LIT:0> , h ] ) , <EOL> ( '<STR_LIT>' , texture1 . tex_coords ) , <EOL> ( '<STR_LIT>' , texture0 . tex_coords ) <EOL> ) <EOL> glActiveTexture ( GL_TEXTURE0 ) <EOL> glEnable ( texture0 . target ) <EOL> glBindTexture ( texture0 . target , texture0 . id ) <EOL> glTexEnvi ( GL_TEXTURE_ENV , GL_TEXTURE_ENV_MODE , GL_REPLACE ) <EOL> glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) <EOL> glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) <EOL> glActiveTexture ( GL_TEXTURE1 ) <EOL> glEnable ( texture1 . target ) <EOL> glBindTexture ( texture1 . target , texture1 . id ) <EOL> glTexEnvi ( GL_TEXTURE_ENV , GL_TEXTURE_ENV_MODE , GL_MODULATE ) <EOL> glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_NEAREST ) <EOL> glTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_NEAREST ) <EOL> batch . draw ( ) <EOL> self . assertEqual ( self . sample ( <NUM_LIT:2> , <NUM_LIT:2> ) , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:0> ) ) <EOL> self . assertEqual ( self . sample ( <NUM_LIT> , <NUM_LIT:2> ) , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:0> ) ) <EOL> self . assertEqual ( self . sample ( <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:0> ) ) <EOL> self . assertEqual ( self . sample ( <NUM_LIT:2> , <NUM_LIT> ) , ( <NUM_LIT:0> , <NUM_LIT:255> , <NUM_LIT:0> ) ) <EOL> window . close ( ) <EOL> def sample ( self , x , y ) : <EOL> color_buffer = pyglet . image . get_buffer_manager ( ) . get_color_buffer ( ) <EOL> buffer = color_buffer . get_image_data ( ) <EOL> data = buffer . get_data ( '<STR_LIT>' , buffer . pitch ) <EOL> i = y * buffer . pitch + x * <NUM_LIT:3> <EOL> r , g , b = data [ i : i + <NUM_LIT:3> ] <EOL> if type ( r ) is str : <EOL> r , g , b = map ( ord , ( r , g , b ) ) <EOL> return r , g , b <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
