Vizard 7 » Command Index » Vizard modules » viz » <viz:window>.screenCapture
7.7

<viz:window>.screenCapture

Capture the screen image to a file or texture

<viz:window>.screenCapture(  
filename  
flags = 0  
)  
filename
Specifies the file name or texture object to save the current screen to.
flags = 0
A combination of the following flags:

Flag

Description

viz.CAPTURE_RGBA

Capture the screen into an RGBA image instead of RGB.

viz.CAPTURE_COPY_TEXTURE

When capturing the screen to a texture, copy the screen contents directly into the texture object on the GPU, instead of downloading the image to the CPU. This increases screen capture performance for texture objects, however the image data will not be available to the script. When this flag is enabled, the existing texture format determines the capture format, and the viz.CAPTURE_RGBA flag will be ignored.

Remarks

Use this command to save a copy of the current graphic screen to a file or texture object. This can be used to automate the creation of a sequence of images that are later compiled into a movie.

Note: The image is not generated immediately. Vizard must wait until the next frame is rendered before it can capture the image.

Return Value

None

Example

Capturing to image file:
# Capture screen to BMP file
viz.window.screenCapture('theScreen.bmp')


Capturing to texture:
# Create blank texture
capture_tex = viz.addBlankTexture([1,1])
.
.
.
# Capture screen to texture
viz.window.screenCapture(capture_tex)


Copy screen to texture:
# Create render texture
capture_tex = viz.addRenderTexture()
.
.
.
# Copy screen to texture
viz.window.screenCapture(capture_tex, flags=viz.CAPTURE_COPY_TEXTURE)