The bge.texture module allows you to manipulate textures during the game.
Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that.
The video and image files can be loaded from the internet using an URL instead of a file name.
In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map.
bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to:
* AVI
* Ogg
* Xvid
* Theora
* dv1394 camera
* video4linux capture card (this includes many webcams)
* videoForWindows capture card (this includes many webcams)
* JPG
The principle is simple: first you identify a texture on an existing object using the :materialID: function, then you create a new texture with dynamic content and swap the two textures in the GPU.
The GE is not aware of the substitution and continues to display the object as always, except that you are now in control of the texture.
When the texture object is deleted, the new texture is deleted and the old texture restored.
FFmpeg video source
video status
replay range
repeat count, -1 for infinite repeat
Type : | int |
---|
frame rate
Type : | float |
---|
Tells if an image is available
Type : | bool |
---|
image data
image size
fast scale of image (near neighbour)
flip image vertically
pixel filter
number of frames of preseek
Type : | int |
---|
deinterlace image
Type : | bool |
---|
Play (restart) video
pause video
stop video (play will replay it from start)
Refresh video - get its status
FFmpeg image source
video status
Tells if an image is available
Type : | bool |
---|
image data
image size
fast scale of image (near neighbour)
flip image vertically
pixel filter
Refresh image, i.e. load it
Reload image, i.e. reopen it
Image source from image buffer
pixel filter
flip image vertically
image data
Load image from buffer
update image buffer
fast scale of image (near neighbour)
image size
bool to tell if an image is available
Image source from mirror
use alpha in texture
background color
size of render area
clipping distance
pixel filter
flip image vertically
image data
Refresh image - invalidate its current content
fast scale of image (near neighbour)
image size
bool to tell if an image is available
use whole viewport to render
Image mixer
pixel filter
flip image vertically
get image source
get image source weight
image data
Refresh image - invalidate its current content
fast scale of image (near neighbour)
set image source
set image source weight
bool to tell if an image is available
Image source from render
use alpha in texture
background color
size of render area
pixel filter
flip image vertically
image data
Refresh image - invalidate its current content
fast scale of image (near neighbour)
image size
bool to tell if an image is available
use whole viewport to render
Image source from viewport
use alpha in texture
size of viewport area being captured
pixel filter
flip image vertically
image data
upper left corner of captured area
Refresh image - invalidate its current content
fast scale of image (near neighbour)
image size
bool to tell if an image is available
use whole viewport to capture
Texture objects
OpenGL Bind Name
Close dynamic texture and restore original
mipmap texture
Refresh texture from source
source of texture
Source filter BGR24 objects
Filter for Blue Screen objects
blue screen color
blue screen color limits
previous pixel filter
Filter for color calculations
matrix [4][5] for color calculation
previous pixel filter
Filter for levels calculations
levels matrix [4] (min, max)
previous pixel filter
Filter for Blue Screen objects
index of color used to calculate normal (0 - red, 1 - green, 2 - blue)
depth of relief
previous pixel filter
Returns a new input filter object to be used with ImageBuff object when the image passed to the ImageBuff.load() function has the 3-bytes pixel format BGR.
Source filter RGBA32 objects
Last error that occurred in a bge.texture function.
Returns: | the description of the last error occurred in a bge.texture function. |
---|---|
Return type: | string |
Returns a buffer corresponding to the current image stored in a texture source object.
Parameters: |
|
---|---|
Return type: | buffer |
Returns: | A object representing the image as one dimensional array of bytes of size (pixel_size*width*height), line by line starting from the bottom of the image. The pixel size and format is determined by the mode parameter. |