|
setUniform1isetUniform1i(name, ix)Names a interger value and passes it from the main program to the vertex or fragment program.name: Type:
string
ix:Type:
integer
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 integer to shadershader.setUniform1i("Dim", 2)####### end of main program def# Import OpenGL code as a stringVertexProgram = """ |