#NEWLINE# def collide_list( self , others ) : #NEWLINE# #INDENT# 'Get a list of Sprites in others that collide with self.' #NEWLINE# glPushAttrib ( ( ( GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ) | GL_ENABLE_BIT ) ) #NEWLINE# glColorMask ( 0 , 0 , 0 , 0 ) #NEWLINE# glEnable ( GL_ALPHA_TEST ) #NEWLINE# glAlphaFunc ( GL_GEQUAL , 0.5 ) #NEWLINE# glClear ( GL_STENCIL_BUFFER_BIT ) #NEWLINE# glStencilFunc ( GL_ALWAYS , self . _collision_stencil , self . _collision_stencil ) #NEWLINE# glStencilOp ( GL_KEEP , GL_REPLACE , GL_REPLACE ) #NEWLINE# glEnable ( GL_STENCIL_TEST ) #NEWLINE# self . draw ( ) #NEWLINE# glStencilFunc ( GL_EQUAL , self . _collision_stencil , self . _collision_stencil ) #NEWLINE# n_query = len ( others ) #NEWLINE# query = ( c_uint * n_query ) ( ) #NEWLINE# glGenQueries ( n_query , query ) #NEWLINE# collisions = [ ] #NEWLINE# for ( i , other ) in enumerate ( others ) : #NEWLINE# #INDENT# glBeginQuery ( GL_SAMPLES_PASSED , query [ i ] ) #NEWLINE# other . draw ( ) #NEWLINE# glEndQuery ( GL_SAMPLES_PASSED ) #NEWLINE# #UNINDENT# for ( i , other ) in enumerate ( others ) : #NEWLINE# #INDENT# result = c_int ( ) #NEWLINE# glGetQueryObjectiv ( query [ i ] , GL_QUERY_RESULT , byref ( result ) ) #NEWLINE# if ( result . value > 0 ) : #NEWLINE# #INDENT# collisions . append ( other ) #NEWLINE# #UNINDENT# #UNINDENT# glDeleteQueries ( n_query , query ) #NEWLINE# glPopAttrib ( ) #NEWLINE# return collisions