#NEWLINE# def bind( self , value ) : #NEWLINE# #INDENT# if ( self . size > 1 ) : #NEWLINE# #INDENT# self . bind_array ( value ) #NEWLINE# return #NEWLINE# #UNINDENT# if hasattr ( value , 'get_uniform_value' ) : #NEWLINE# #INDENT# value = value . get_uniform_value ( ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# count = len ( value ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# value = [ value ] #NEWLINE# count = 1 #NEWLINE# #UNINDENT# cache = App . instance . current_window . current_program . cache #NEWLINE# if ( not cache . set ( self . location , value ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( self . data_type in Uniform . MATS ) : #NEWLINE# #INDENT# funcs = { #NEWLINE# #INDENT# 4 : glUniformMatrix2fv , #NEWLINE# 9 : glUniformMatrix3fv , #NEWLINE# 16 : glUniformMatrix4fv , #NEWLINE# #UNINDENT# } #NEWLINE# funcs [ count ] ( self . location , 1 , False , ( c_float * count ) ( * value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . data_type in Uniform . FLOATS ) : #NEWLINE# #INDENT# funcs = { #NEWLINE# #INDENT# 1 : glUniform1f , #NEWLINE# 2 : glUniform2f , #NEWLINE# 3 : glUniform3f , #NEWLINE# 4 : glUniform4f , #NEWLINE# #UNINDENT# } #NEWLINE# funcs [ count ] ( self . location , * value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( self . data_type in Uniform . INTS ) or ( self . data_type in Uniform . BOOLS ) ) : #NEWLINE# #INDENT# funcs = { #NEWLINE# #INDENT# 1 : glUniform1i , #NEWLINE# 2 : glUniform2i , #NEWLINE# 3 : glUniform3i , #NEWLINE# 4 : glUniform4i , #NEWLINE# #UNINDENT# } #NEWLINE# funcs [ count ] ( self . location , * value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . data_type in Uniform . SAMPLERS ) : #NEWLINE# #INDENT# glUniform1i ( count . location , * value )