Vizard 7 » Command Index » Vizard modules » viz » <viz>.addTexture
7.7

<viz>.addTexture

Adds a texture

<viz>.addTexture(  
fileName  
type = viz.TEX_2D  
flags = 0  
)  
fileName
Name of texture file
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.

viz.CACHE_CLONE

If a texture object has already been created from the same file, the existing texture will be returned.

viz.CACHE_COPY

If a texture object has already been created from the same file, a copy of the existing texture will be returned.

Remarks

This command will attempt to create a texture object from the specified file. The texture can be applied to any node3d object.

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.

Example

texture = viz.addTexture('somefile.jpg')

See also

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