| Home | zeGraph lib | Lua lib | Custom lib | Tutorials | Notes | XML Script | C-Talk | Z-Script |
Graph
   axis
   blend
   color
   color bar
   fog
   freetype
   light
   line
   material
   node
   point
   plot
   polygon
   render
   scene
   stencil
   texcoord
   text
   texture
   vertex
Utility
   array
   bio
   hdf
   make
   math
   netcdf
Auxiliary
   curl
   expact
   sqlite
   window

zeTexture

Use .new("texture") to create the object. It loads an image from a file and uses it as the texture of objects that has texture coordinates.

:get(arr, flag)

Gets a color component of the image to the array (char type) according to the flag: "r" for red, "g" for green, "b" for blue, and "a" for alpha . The the number of rows (record) and columns (vector) of the array must equal to the image height and with, respectively.

:size()

Returns the image width and height in pixel.

:set{...}

Sets texture properties with a Lua table. Valid key-value pairs in the Lua table are listed as follows.

Key Value Type Remark
env modulate String Sets the texture environment parameter of the OpenGL glTexEnvi() function to GL_MODULATE (default).
  decal String Sets the texture environment parameter of the OpenGL glTexEnvi() function to GL_DECAL.
  blend String Sets the texture environment parameter of the OpenGL glTexEnvi() function to GL_BLEND.
warps clamp String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_WRAP_S and GL_CLAMP.
  repeat String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_WRAP_S and GL_REPEAT.
warpt clamp String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_WRAP_T and GL_CLAMP.
  repeat String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_WRAP_T and GL_REPEAT.
min linear String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_MIN_FILTE and GL_LINEAR.
  nearest String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_MIN_FILTE and GL_NEAREST.
mag linear String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_MAG_FILTE and GL_LINEAR.
  nearest String Sets the texture parameter of the OpenGL glTexParameteri() function to GL_TEXTURE_MAG_FILTE and GL_NEAREST.
enable flag Boolean If true, enables the object; otherwise disables it.
image file String Loads the image in the file as the texture.
red array zeArray of double Replaces the red component of texture image with data in the array. Refer to the get() function for array size requirement.
green array zeArray of double Replaces the green component of texture image with data in the array. Refer to the get() function for array size requirement.
blue array zeArray of double Replaces the blue component of texture image with data in the array. Refer to the get() function for array size requirement.
alpha array zeArray of double Replaces the alpha component of texture image with data in the array. Refer to the get() function for array size requirement.