Vizard 7 » Reference » Appearance & Texturing » Texture types
7.6

Texture types

If you are familiar with OpenGL you will notice that Vizard has exposed some of the basic texture options to the user. When adding textures you can specify which type of OpenGL texture to create. The most common and default type is a 2D texture. Here is a list of the available texture types:

Texture type flag

Description

viz.TEX_1D

One dimensional texture

viz.TEX_2D

Two dimensional texture

viz.TEX_3D

Three dimensional texture

viz.TEX_CUBE

Cube mapped texture. Composed of 6 textures that represent each side of a cube. Most commonly used for environment mapping.

viz.TEX_RECT

Texture rectangle. Same as a 2D texture except that texture coordinates are in pixel values instead of 0 to 1. Does not require image size to be a power of 2.

For instance, if you wanted to create a Texture Rectangle you would use the following code:

texture = viz.add('myfile.jpeg',viz.TEX_RECT)

To create a cubemap you would do something similar to this:

texture = viz.add('right.jpg',TEX_CUBE)
texture.load('left.jpg',NEGATIVE_X)
texture.load('down.jpg',NEGATIVE_Y)
texture.load('up.jpg',POSITIVE_Y)
texture.load('front.jpg',POSITIVE_Z)
texture.load('back.jpg',NEGATIVE_Z) 
 

Loading all 6 textures for a cube map can become quite tedious, that is why Vizard has a built-in method for loading a cube map. Let's say you have the following textures that represent a cube map:

 

sky_posx.jpg

sky_negx.jpg

sky_posy.jpg

sky_negy.jpg

sky_posz.jpg

sky_negz.jpg

 

You could use the following code to load the cube map:

texture = viz.addEnvironmentMap('sky.jpg')

Vizard will automatically add the _posx, _negx, and so on to the end of the texture name and load each into a cube map.

See also

In this section:

Appearance & texturing basics

Texture wrapping

Multi-texturing

Environment mapping

Texture appearance and filtering

Texture matrix

Visibility

Draw order & Z offsetting

Projecting textures

Appearance & texturing command table

Other sections:

Tutorial: 360 panoramas