|
setUniform2fsetUniform2f(name, fx, fy)Used to name two float values and pass them from the main program to the vertex or fragment program.name: Type:
string
fx:Type: float
fy:Type: float
Sample Code# define the main part of the programdef main():# get the current scenescene = GameLogic.getCurrentScene()# get a list of the objects in the sceneobjList = scene.objects# Get the object you want to useobj = objList['OBCube']# Only one mesh on this Cubemesh = obj.meshes[0]# only one material on this meshmat = mesh.materials[0]# Using Blender GLSL Materials or Blender Multitexture Materials?if hasattr( mat, 'getMaterialIndex') == True:#Get shader envelopeshader = mat.getShader()# shader envelope created?if shader != None:# set the shadershader.setSource(VertexProgram, FragmentProgram, True)# pass vec2 float variable to shadershader.setUniform2f("RedGreen", 0.0, 1.0)####### end of main program def# Import OpenGL code as a stringVertexProgram = """ |