Vizard 8 » Command Index » Vizard modules » viz » <viz>.addTextureFromBuffer
8.0

<viz>.addTextureFromBuffer

Add a texture from a memory buffer

<viz>.addTextureFromBuffer(  
filename  
buffer  
type = viz.TEX_2D  
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.

type = viz.TEX_2D
viz.TEX_1D
viz.TEX_2D
viz.TEX_3D
viz.TEX_CUBE
viz.TEX_RECT
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

This command will load a texture using data from memory, instead of a file. The filename must contain the same extension as the format the buffer represents.

If the viz.LOAD_ASYNC flag is set, the texture will be loaded asynchronously. In this case, the command will return immediately with a valid texture handle. 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

<texture> object

See also

<viz>.addTexture
<viz>.addBlankTexture
<viz>.addRenderTexture
<viz>.addVideo
<vizact>.onAsyncLoad
<viztask>.waitAsyncLoad
<texture>.getAsyncStatus