def test_example2():
 vert_template = Function('\n    void main(void)\n    {\n        gl_Position = $position;\n    }\n    ')
 transformScale = Function('\n    vec4 transform_scale(vec4 pos)\n    {\n        pos.xyz *= $scale;\n        return pos;\n    }\n    ')
 class Transform(object, ):
  def __init__(self):
   self.func = Function(transformScale)
   self.func['scale'] = 'uniform float'
  def set_scale(self, scale):
   self.func['scale'].value = scale
 transforms = [Transform(), Transform(), Transform()]
 code = Function(vert_template)
 ob = Variable('attribute vec3 a_position')
 for trans in transforms:
  ob = trans.func(ob)
 code['position'] = ob
 print code

def test_example2 ( ) : vert_template = Function ( '\n    void main(void)\n    {\n        gl_Position = $position;\n    }\n    ' ) transformScale = Function ( '\n    vec4 transform_scale(vec4 pos)\n    {\n        pos.xyz *= $scale;\n        return pos;\n    }\n    ' ) class Transform ( object , ) : def __init__ ( self ) : self . func = Function ( transformScale ) self . func [ 'scale' ] = 'uniform float' def set_scale ( self , scale ) : self . func [ 'scale' ] . value = scale transforms = [ Transform ( ) , Transform ( ) , Transform ( ) ] code = Function ( vert_template ) ob = Variable ( 'attribute vec3 a_position' ) for trans in transforms : ob = trans . func ( ob ) code [ 'position' ] = ob print code
demonstrate how a transform would work .