ImageRender: 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 a list of the cameras
camList = scene.cameras

# get camera being used for render to texture
# my camera is named Security_Cam

cam = camList["Security_Cam"]

# get list of objects in scene
objList = scene.objects

# get object to render to
# my object is named SecurityMonitor

obj = objList["SecurityMonitor"]

# get the SecurityMonitor material ID
# Name of my render material is Screen
matID = bge.texture.materialID(obj, "MAScreen")

# set the texture
renderToTexture = bge.texture.Texture(obj, matID)

# get the texture image
renderToTexture.source = bge.texture.ImageRender(scene,cam)

# get if image is flipped
upsideDown = renderToTexture.source.flip

# save RenderToTexture as an object variable
obj["Render"] = renderToTexture

# update the texture
renderToTexture.refresh(True)

Sample Code

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

# import bge module
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the cameras
camList = scene.cameras

# get camera being used for render to texture
# my camera is named Security_Cam

cam = camList["Security_Cam"]

# get list of objects in scene
objList = scene.objects

# get object to render to
# my object is named SecurityMonitor

obj = objList["SecurityMonitor"]

# get the SecurityMonitor material ID
# Name of my render material is Screen
matID = bge.texture.materialID(obj, "MAScreen")

# set the texture
renderToTexture = bge.texture.Texture(obj, matID)

# get the texture image
renderToTexture.source = bge.texture.ImageRender(scene,cam)

# flip image
renderToTexture.source.flip = True

# save RenderToTexture as an object variable
obj["Render"] = renderToTexture

# update the texture
renderToTexture.refresh(True)