
ImageViewport()
- Uses viewport content as the texture.
Return Type:
- ImageViewport Object.
Example Blend:

Sample Code
###################### use viewport content as the texture
# import bge module
import bge
# get current scene
scene = bge.logic.getCurrentScene()
# get list of objects in scene
objList = scene.objects
# get object to render to
# my object is named Security_Monitor
obj = objList["Security_Monitor"]
# get the Security_Monitor material ID
# Name of my render material is Screen
matID = bge.texture.materialID(obj, "MAScreen")
# set the texture
viewport_texture = bge.texture.Texture(obj, matID)
# get the texture image
viewport_texture.source = bge.texture.ImageViewport()
# save as an object property
obj["image_viewport"] = viewport_texture
# update texture
viewport_texture.refresh(True)