ImageViewport: flip

flip
  • set/get whether or not the image is flipped vertically (upside down)

Type: 

  • boolean
  • True = flip image
  • False = don't flip image
Sample Code

###################### get if image is flipped

# 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")

# get the texture
viewport_texture = bge.texture.Texture(obj, matID)

# get the texture image source
viewport_texture.source = bge.texture.ImageViewport()

# get if image is flipped
status = viewport_texture.source.flip

# save as an object property
obj["image_viewport"] = viewport_texture

# update texture
viewport_texture.refresh(True)

Sample Code

###################### set if image is flipped

# 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")

# get the texture
viewport_texture = bge.texture.Texture(obj, matID)

# get the texture image source
viewport_texture.source = bge.texture.ImageViewport()

# set image to flipped
viewport_texture.source.flip = True

# save as an object property
obj["image_viewport"] = viewport_texture

# update texture
viewport_texture.refresh(True)