|
setNumberOfPassessetNumberOfPasses( max-pass )Sets the number of times the shader is applied to the material.max-pass: 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 object named CubeobjCube = objList["OBCube"]# only one mesh on this cubemesh = objCube.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()# did it get the shader envelope?if shader != None:# set the source and use itshader.setSource(VertexProgram,FragmentProgram, True)# set number of passes to 3shader.setNumberOfPasses(3)####### end of main program defVertexProgram = """ void main(){// OpenGL glsl codegl_Position = ftransform();}"""FragmentProgram = """ |