Vizard 7 » Command Index » Vizard objects » texture » <texture>.loadBuffer
7.6

<texture>.loadBuffer

Load image into texture from a buffer

<texture>.loadBuffer(  
filename  
buffer  
face = viz.POSITIVE_X  
flags = 0  
)  
filename
Filename associated with the buffer. The extension of the filename will tell Vizard what image format the buffer provides (jpg, gif, bmp, etc..).
buffer
Buffer containing the image file data or one of the following buffer flags:

Buffer flags

viz.BUFFER_MMAP

Load buffer through a memory mapped file. This can be used in cluster mode to have the master transfer the file contents to the clients at runtime.

face = viz.POSITIVE_X
This is an optional argument used only with Cube Mapped or 3D textures.

With Cube Mapped textures it specifies which face of the cube to apply the image to. This can be one of the following values:

viz.POSITIVE_X
viz.NEGATIVE_X
viz.POSITIVE_Y
viz.NEGATIVE_Y
viz.POSITIVE_Z
viz.NEGATIVE_Z

With 3D textures it specifies which depth slot to load the image into.

In both cases, the file must contain the same width, height, and pixel format as the original texture.
flags = 0
Can include any combination of the following load flags:

Load Flag

Description

viz.LOAD_ASYNC

Load the texture asynchronously. See remarks below.

Remarks

Use this to change the image of the texture. If you load a new image onto the texture, then all objects that had this texture applied to will change also.

If the viz.LOAD_ASYNC flag is set, the texture will be loaded asynchronously. In this case, the command will return immediately with True. The status of the async operation can be queried using the <texture>.getAsyncStatus command. When the async operation completes, due to either success or failure, a viz.ASYNC_EVENT will be triggered. The <vizact>.onAsyncLoad or <viztask>.waitAsyncLoad commands can be used to automatically process this event for a specified texture.

Return Value

True/False

See also

<texture>.load
<texture>.setImageData
<vizact>.onAsyncLoad
<viztask>.waitAsyncLoad
<texture>.getAsyncStatus