| 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

zePolygon

Use .new("polygon") to create the object. This is one of the shape objects that the OpenGL display list is implemented. A polygon object is compiled into a display list if activated through the render. By default the object is treated as filled GL_POLYGON. Improperly setting the polygon type is the most misuse of the object. Check whether you have set the type correctly when the rendered result is not what you anticipated. The order of calling translate, scale, and rotate function is important.

:rotatex(angle)
:rotatey(angle)
:rotatez(angle)

These functions rotate the object around the x-, y- and z-axis, respectively. The calling order matters.

:reset()

Resets the transformation to none.

:scale(xs, ys, zs)

Scales the object in x, y, and z direction for the factors of xs, ys, and zs.

:translate(dx, dy, dz)

Moves the object dx, dy, and dz away from the current position.

:update()

Forces to update the rendering of the object.

:set{...}

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

Key Value Type Remark
color {r, g, b, a} Numbers (0 to 1) in table Sets the polygon color to use when no vertex color object is used or the vertex color object contains no data.
cull side Number If side > 0, culls front; if side < 0; culls back; otherwise no cull (default).
clockwise flag Boolean If flag is true, the face of a polyogn is clockwise; otherwise anticlockwise (default).
type triangles String Instructs the polygon that its vertex object contains data of triangles (GL_TRIANGLES).
  trianglefan String Instructs the polygon that its vertex object contains data of triangle fan (GL_TRIANGLE_FAN).
  trinaglestrip String Instructs the polygon that its vertex object contains data of triangle strip(GL_TRIANGLE_STRIP).
  quads String Instructs the polygon that its vertex object contains data of quads (GL_QUADS).
  quadstrip String Instructs the polygon that its vertex object contains data of quad strip (GL_QUAD_STRIP).
  polygon String Instructs the polygon that its vertex object contains data of polygon (GL_POLYGON).
fill flag Number If flag = 0, draws polygon outline; if flag < 0, draws polygon vertex point; otherwise draws filled polygon.
linewidth width Number (>0) Specifies the line with when the polygon is drawn as outline.
enable flag Boolean Enable (default) and disable the object
vertex obj zeVertex Sets the vertex object.
vertex_normal obj zeVertex Sets the vertex normal object.
vertex_color obj zeColor Sets the vertex color object.
texture_coord obj zeTexCoord Sets the texture coordinate object.