
- set/get the maximum resolution of the source image
Type:
- list: [ width, height]
- pixel width of the source image
- Type: integer
- pixel height of the source image.
- Type: integer
- capsize is the maximum resolution of the source image.
- capsize is not the size of the texture that the source image is being displayed on.
- capsize = 256 by 256 pixels.
- actual resolution of source image is 128 x 128 pixels.
- source image resolution will remain unchanged at 128 x 128 pixels.
- display texture size = 512 pixels by 512 pixels.
- source image of 128 x 128 pixels will be scaled to 512 x 512 pixels.
- capsize = 256 by 256 pixels.
- actual resolution of source image is 1024 x 1024 pixels.
- source image resolution will be resized to 256 x 256 pixels.
- display texture size = 512 pixels by 512 pixels.
- source image of 256 x 256 pixels will be scaled to 512 x 512 pixels.

###################### get image source capsize
# 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 capsize
size = renderToTexture.source.capsize
# save RenderToTexture as an object variable
obj["Render"] = renderToTexture
# update the texture
renderToTexture.refresh(True)
###################### set the image source capsize
# 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)
# set capsize
# I'm setting capsize to 256 x 256
renderToTexture.source.capsize = [256, 256]
# save RenderToTexture as an object variable
obj["Render"] = renderToTexture
# update the texture
renderToTexture.refresh(True)