
- Returns a numeric value that can be used in the Video Texture module to create a dynamic texture.
Return Type:
- integer
obj:
- The game object that holds the texture.
- Type: KX_GameObject
- Name of the texture or material you want to make dynamic.
- Type: string
- Material name must have MA prefix.
Material must have an image in the first texture channel.
If the material name is Canvas, you'd use "MACanvas"
- Texture image name must have IM prefix.
Texture image must be in the first texture channel.
If the texture image name is Static.jpg, you'd use "IMStatic.jpg"

###################### get materialID
# import bge module
import bge
# get current scene
scene = bge.logic.getCurrentScene()
# get list of objects in scene
objList = scene.objects
# get object named Mirror
obj = objList["Mirror"]
# get the mirror material ID
# Name of my Mirror material is Reflect
matID = bge.texture.materialID(obj, "MAReflect")
# get a list of the cameras
camList = scene.cameras
# get the camera named PlayerOne
cam = camList["PlayerOne"]
# texture I'm using for the mirror is in first texture channel
texChannel = 0
# get the texture
mirror = bge.texture.Texture(obj, matID, texChannel)
# get the mirror source
mirror.source = bge.texture.ImageMirror(scene, cam, obj, matID)
# save the mirror as an object variable
obj["Mirror"] = mirror
# update the mirror image
mirror.refresh(True)