
- positions a Video Texture source on top of an already created Video Texture.
- Think 'Picture in Picture'.
image:
- image loaded from a buffer
- Type: bgl buffer
- pixel width of the image
- Type: integer
- pixel height of the image
- Type: integer
- x pixel position of the image.
- bottom left corner of already created Video texture is 0, 0.
- Type: integer
- y pixel position of the image.
- bottom left corner of already created Video texture is 0, 0.
- Type: integer
- ImageBuff sources: ImageFFmpeg, ImageMirror, ImageMix, ImageRender, ImageViewport and VideoFFmpeg.

###################### ImageBuff: plot
#import bge
import bge
# get current scene
scene = bge.logic.getCurrentScene()
# get list of objects in scene
objList = scene.objects
# get object named Painting
obj = objList["Painting"]
# get matID for the obj named Painting
# I named the material Canvas
matID = bge.texture.materialID(obj, "MACanvas")
# get the 1st texture on object named Painting
portrait = bge.texture.Texture(obj, matID)
# get the name of the image
# I'm using an image named Mona_Lisa.jpg
imageName1 = "Mona_Lisa.jpg"
# get image path
# Mona_Lisa.jpg is in same directory as saved blend
imagePath1 = bge.logic.expandPath("//" + imageName1)
# get image as an ImageFFmpeg
image1 = bge.texture.ImageFFmpeg(imagePath1)
# load image into a bgl buffer
image1_buffer = bge.texture.imageToArray(image1, 'RGB')
# get image size
image1_size = image1.size
# use ImageBuff as the source
portrait.source = bge.texture.ImageBuff()
# load the image from the buffer into ImageBuff
portrait.source.load(image1_buffer, image1_size[0], image1_size[1])
############# imageBuff: plot
# get the name of the image
# I'm using an image named Leonardo_da_Vinci.jpg
imageName2 = "Leonardo_da_Vinci.jpg"
# get image path
# Leonardo_da_Vinci.jpg is in same directory as saved blend
imagePath2 = bge.logic.expandPath("//" + imageName2)
# get image as an ImageFFmpeg
image2 = bge.texture.ImageFFmpeg(imagePath2)
# load image into a bgl buffer
image2_buffer = bge.texture.imageToArray(image2, 'RGBA')
# get image size
image2_size = image2.size
# load image 2 from buffer 2 into ImageBuff
# position 50 & 50 pixels from bottom left corner
portrait.source.plot(image2_buffer, image2_size[0], image2_size[1], 50, 50)
######################
# save as an object variable
obj["Portrait"] = portrait
# display the image
portrait.refresh(True)