
- Activates nearest scaling algorithm.
Type:
- boolean
- True = activate nearest scaling algorithm.
- False = don't activate nearest scaling algorithm.
- Video Texture width and height should be a power of 2.
- If the Video Texture is not a power of 2, the graphics pipeline automatically rescales the texture to a power of 2.
- Graphics pipeline doesn't always use the nearest scaling algorithm.
- 2 x 2
- 4 x 4
- 8 x 8
- 16 x 16
- 32 x 32
- 64 x 64
- 128 x 128
- 256 x 256
- 512 x 512
- etc
- And any combination. 128 x 512 is a power of 2.
- A texture of 300 x 300 will be automatically rescaled by the graphics pipeline to 512 x 512.
- A texture of 130 x 520 will be automatically rescaled by the graphics pipeline to 256 x 1024

###################### get scaling status
# 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
viewport_texture.source = bge.texture.ImageViewport()
# get scaling status
status = viewport_texture.source.scale
# save as an object property
obj["image_viewport"] = viewport_texture
# update texture
viewport_texture.refresh(True)
###################### set scaling status
# 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
viewport_texture.source = bge.texture.ImageViewport()
# set scaling status to True
viewport_texture.source.scale = True
# save as an object property
obj["image_viewport"] = viewport_texture
# update texture
viewport_texture.refresh(True)