mem() = binary() | tuple()

vertex() = {float(), float(), float()}

tesselate(Normal, Vs::[Vs]) -> {Triangles, VertexPos}

Normal = vertex()

Vs = vertex()

Triangles = [integer()]

VertexPos = binary()

General purpose polygon triangulation.
The first argument is the normal and the second a list of
vertex positions. Returned is a list of indecies of the vertices
and a binary (64bit native float) containing an array of
vertex positions, it starts with the vertices in Vs and
may contain newly created vertices in the end.

A series of mipmap levels from Base to Max is built by decimating Data
in half until size 1*1 is reached. At each level, each texel in the halved mipmap
level is an average of the corresponding two texels in the larger mipmap level. gl:texImage1D/8
is called to load these mipmap levels from Base to Max . If Max is
larger than the highest mipmap level for the texture of the specified size, then a GLU
error code is returned (see glu:errorString/1 ) and nothing is loaded.

For example, if Level is 2 and Width is 16, the following levels are possible:
16*1, 8*1, 4*1, 2*1, 1*1. These correspond to levels 2 through 6 respectively.
If Base is 3 and Max is 5, then only mipmap levels 8*1, 4*1 and 2*1
are loaded. However, if Max is 7, then an error is returned and nothing is loaded
since Max is larger than the highest mipmap level which is, in this case, 6.

The highest mipmap level can be derived from the formula log 2(width*2 level).

See the gl:texImage1D/8 reference page for a description of the acceptable values
for Type parameter. See the gl:drawPixels/5 reference page for a description
of the acceptable values for Level parameter.

Initially, the Width of Data is checked to see if it is a power of 2. If
not, a copy of Data is scaled up or down to the nearest power of 2. (If Width
is exactly between powers of 2, then the copy of Data will scale upwards.) This
copy will be used for subsequent mipmapping operations described below. For example, if Width
is 57, then a copy of Data will scale up to 64 before mipmapping takes place.

Then, proxy textures (see gl:texImage1D/8 ) are used to determine if the implementation
can fit the requested texture. If not, Width is continually halved until it fits.

Next, a series of mipmap levels is built by decimating a copy of Data in half
until size 1*1 is reached. At each level, each texel in the halved mipmap level is an
average of the corresponding two texels in the larger mipmap level.

gl:texImage1D/8 is called to load each of these mipmap levels. Level 0 is a copy
of Data . The highest level is (log 2)(width). For example, if Width is 64 and the implementation
can store a texture of this size, the following mipmap levels are built: 64*1, 32*1,
16*1, 8*1, 4*1, 2*1, and 1*1. These correspond to levels 0 through 6, respectively.

See the gl:texImage1D/8 reference page for a description of the acceptable values
for the Type parameter. See the gl:drawPixels/5 reference page for a description
of the acceptable values for the Data parameter.

A series of mipmap levels from Base to Max is built by decimating Data
in half along both dimensions until size 1*1 is reached. At each level, each texel
in the halved mipmap level is an average of the corresponding four texels in the larger
mipmap level. (In the case of rectangular images, the decimation will ultimately reach
an N*1 or 1*N configuration. Here, two texels are averaged instead.) gl:texImage2D/9
is called to load these mipmap levels from Base to Max . If Max is
larger than the highest mipmap level for the texture of the specified size, then a GLU
error code is returned (see glu:errorString/1 ) and nothing is loaded.

For example, if Level is 2 and Width is 16 and Height is 8, the
following levels are possible: 16*8, 8*4, 4*2, 2*1, 1*1. These correspond to
levels 2 through 6 respectively. If Base is 3 and Max is 5, then only mipmap
levels 8*4, 4*2, and 2*1 are loaded. However, if Max is 7, then an error is
returned and nothing is loaded since Max is larger than the highest mipmap level
which is, in this case, 6.

The highest mipmap level can be derived from the formula log 2(max(width height)*2 level).

See the gl:texImage1D/8 reference page for a description of the acceptable values
for Format parameter. See the gl:drawPixels/5 reference page for a description
of the acceptable values for Type parameter.

Initially, the Width and Height of Data are checked to see if they
are a power of 2. If not, a copy of Data (not Data ), is scaled up or down
to the nearest power of 2. This copy will be used for subsequent mipmapping operations
described below. (If Width or Height is exactly between powers of 2, then
the copy of Data will scale upwards.) For example, if Width is 57 and Height
is 23, then a copy of Data will scale up to 64 in Width and down to 16
in depth, before mipmapping takes place.

Then, proxy textures (see gl:texImage2D/9 ) are used to determine if the implementation
can fit the requested texture. If not, both dimensions are continually halved until it
fits. (If the OpenGL version is (<= 1.0, both maximum texture dimensions are clamped
to the value returned by gl:getBooleanv/1 with the argument ?GLU_MAX_TEXTURE_SIZE
.)

Next, a series of mipmap levels is built by decimating a copy of Data in half
along both dimensions until size 1*1 is reached. At each level, each texel in the halved
mipmap level is an average of the corresponding four texels in the larger mipmap level.
(In the case of rectangular images, the decimation will ultimately reach an N*1 or 1*N
configuration. Here, two texels are averaged instead.)

gl:texImage2D/9 is called to load each of these mipmap levels. Level 0 is a copy
of Data . The highest level is (log 2)(max(width height)). For example, if Width is 64 and Height
is 16 and the implementation can store a texture of this size, the following mipmap levels
are built: 64*16, 32*8, 16*4, 8*2, 4*1, 2*1, and 1*1 These correspond to
levels 0 through 6, respectively.

See the gl:texImage1D/8 reference page for a description of the acceptable values
for Format parameter. See the gl:drawPixels/5 reference page for a description
of the acceptable values for Type parameter.

A series of mipmap levels from Base to Max is built by decimating Data
in half along both dimensions until size 1*1*1 is reached. At each level, each texel
in the halved mipmap level is an average of the corresponding eight texels in the larger
mipmap level. (If exactly one of the dimensions is 1, four texels are averaged. If exactly
two of the dimensions are 1, two texels are averaged.) gl:texImage3D/10 is called
to load these mipmap levels from Base to Max . If Max is larger than
the highest mipmap level for the texture of the specified size, then a GLU error code
is returned (see glu:errorString/1 ) and nothing is loaded.

For example, if Level is 2 and Width is 16, Height is 8 and Depth
is 4, the following levels are possible: 16*8*4, 8*4*2, 4*2*1, 2*1*1, 1*1*1.
These correspond to levels 2 through 6 respectively. If Base is 3 and Max
is 5, then only mipmap levels 8*4*2, 4*2*1, and 2*1*1 are loaded. However, if Max
is 7, then an error is returned and nothing is loaded, since Max is larger than
the highest mipmap level which is, in this case, 6.

The highest mipmap level can be derived from the formula log 2(max(width height depth)*2 level).

See the gl:texImage1D/8 reference page for a description of the acceptable values
for Format parameter. See the gl:drawPixels/5 reference page for a description
of the acceptable values for Type parameter.

Initially, the Width , Height and Depth of Data are checked
to see if they are a power of 2. If not, a copy of Data is made and scaled up or
down to the nearest power of 2. (If Width , Height , or Depth is exactly
between powers of 2, then the copy of Data will scale upwards.) This copy will
be used for subsequent mipmapping operations described below. For example, if Width
is 57, Height is 23, and Depth is 24, then a copy of Data will scale
up to 64 in width, down to 16 in height, and up to 32 in depth before mipmapping takes
place.

Then, proxy textures (see gl:texImage3D/10 ) are used to determine if the implementation
can fit the requested texture. If not, all three dimensions are continually halved until
it fits.

Next, a series of mipmap levels is built by decimating a copy of Data in half
along all three dimensions until size 1*1*1 is reached. At each level, each texel in
the halved mipmap level is an average of the corresponding eight texels in the larger
mipmap level. (If exactly one of the dimensions is 1, four texels are averaged. If exactly
two of the dimensions are 1, two texels are averaged.)

gl:texImage3D/10 is called to load each of these mipmap levels. Level 0 is a copy
of Data . The highest level is (log 2)(max(width height depth)). For example, if Width is 64, Height
is 16, and Depth is 32, and the implementation can store a texture of this size,
the following mipmap levels are built: 64*16*32, 32*8*16, 16*4*8, 8*2*4, 4*1*2,
2*1*1, and 1*1*1. These correspond to levels 0 through 6, respectively.

See the gl:texImage1D/8 reference page for a description of the acceptable values
for Format parameter. See the gl:drawPixels/5 reference page for a description
of the acceptable values for Type parameter.

See external documentation.

checkExtension(ExtName, ExtString) -> 0 | 1

This is used to check for the presence for OpenGL, GLU, or GLX extension names by passing
the extension strings returned by gl:getString/1 , glu:getString/1 , see glXGetClientString
, see glXQueryExtensionsString, or see glXQueryServerString, respectively,
as ExtString .

See external documentation.

cylinder(Quad, Base, Top, Height, Slices, Stacks) -> ok

Quad = integer()

Base = float()

Top = float()

Height = float()

Slices = integer()

Stacks = integer()

Draw a cylinder

glu:cylinder draws a cylinder oriented along the z axis. The base of the
cylinder is placed at z = 0 and the top at z= height. Like a sphere, a cylinder
is subdivided around the z axis into slices and along the z axis into stacks.

Note that if Top is set to 0.0, this routine generates a cone.

If the orientation is set to ?GLU_OUTSIDE (with glu:quadricOrientation/2 ),
then any generated normals point away from the z axis. Otherwise, they point toward
the z axis.

If texturing is turned on (with glu:quadricTexture/2 ), then texture coordinates
are generated so that t ranges linearly from 0.0 at z = 0 to 1.0 at z
= Height , and s ranges from 0.0 at the +y axis, to 0.25 at the +x
axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0
at the +y axis.

See external documentation.

deleteQuadric(Quad) -> ok

Quad = integer()

Destroy a quadrics object

glu:deleteQuadric destroys the quadrics object (created with glu:newQuadric/0 )
and frees any memory it uses. Once glu:deleteQuadric has been called, Quad
cannot be used again.

See external documentation.

disk(Quad, Inner, Outer, Slices, Loops) -> ok

Quad = integer()

Inner = float()

Outer = float()

Slices = integer()

Loops = integer()

Draw a disk

glu:disk renders a disk on the z = 0 plane. The disk has a radius of Outer
and contains a concentric circular hole with a radius of Inner . If Inner
is 0, then no hole is generated. The disk is subdivided around the z axis into
slices (like pizza slices) and also about the z axis into rings (as specified by Slices
and Loops , respectively).

With respect to orientation, the +z side of the disk is considered to be outside
(see glu:quadricOrientation/2 ). This means that if the orientation is set to ?GLU_OUTSIDE
, then any normals generated point along the +z axis. Otherwise, they point along
the -z axis.

If texturing has been turned on (with glu:quadricTexture/2 ), texture coordinates
are generated linearly such that where r= outer, the value at (r, 0, 0) is (1,
0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at
(0, -r, 0) it is (0.5, 0).

See external documentation.

errorString(Error) -> string()

Error = enum()

Produce an error string from a GL or GLU error code

glu:errorString produces an error string from a GL or GLU error code. The string
is in ISO Latin 1 format. For example, glu:errorString(?GLU_OUT_OF_MEMORY)
returns the string out of memory.

The standard GLU error codes are ?GLU_INVALID_ENUM, ?GLU_INVALID_VALUE,
and ?GLU_OUT_OF_MEMORY. Certain other GLU functions can return specialized error
codes through callbacks. See the gl:getError/0 reference page for the list of
GL error codes.

See external documentation.

getString(Name) -> string()

Name = enum()

Return a string describing the GLU version or GLU extensions

glu:getString returns a pointer to a static string describing the GLU version or
the GLU extensions that are supported.

The version number is one of the following forms:

major_number.minor_numbermajor_number.minor_number.release_number.

The version string is of the following form:

version number<space>vendor-specific information

Vendor-specific information is optional. Its format and contents depend on the implementation.

The standard GLU contains a basic set of features and capabilities. If a company or group
of companies wish to support other features, these may be included as extensions to the
GLU. If Name is ?GLU_EXTENSIONS, then glu:getString returns a space-separated
list of names of supported GLU extensions. (Extension names never contain spaces.)

glu:lookAt creates a viewing matrix derived from an eye point, a reference point
indicating the center of the scene, and an UP vector.

The matrix maps the reference point to the negative z axis and the eye point to
the origin. When a typical projection matrix is used, the center of the scene therefore
maps to the center of the viewport. Similarly, the direction described by the UP
vector projected onto the viewing plane is mapped to the positive y axis so that
it points upward in the viewport. The UP vector must not be parallel to the line
of sight from the eye point to the reference point.

and glu:lookAt is equivalent to glMultMatrixf(M); glTranslated(-eyex, -eyey,
-eyez);

See external documentation.

newQuadric() -> integer()

Create a quadrics object

glu:newQuadric creates and returns a pointer to a new quadrics object. This object
must be referred to when calling quadrics rendering and control functions. A return value
of 0 means that there is not enough memory to allocate the object.

See external documentation.

ortho2D(Left, Right, Bottom, Top) -> ok

Left = float()

Right = float()

Bottom = float()

Top = float()

Define a 2D orthographic projection matrix

glu:ortho2D sets up a two-dimensional orthographic viewing region. This is equivalent
to calling gl:ortho/6 with near= -1 and far= 1.

See external documentation.

partialDisk(Quad, Inner, Outer, Slices, Loops, Start, Sweep) -> ok

Quad = integer()

Inner = float()

Outer = float()

Slices = integer()

Loops = integer()

Start = float()

Sweep = float()

Draw an arc of a disk

glu:partialDisk renders a partial disk on the z= 0 plane. A partial disk is similar
to a full disk, except that only the subset of the disk from Start through Start
+ Sweep is included (where 0 degrees is along the +f2yf axis, 90 degrees along
the +x axis, 180 degrees along the -y axis, and 270 degrees along the -x
axis).

The partial disk has a radius of Outer and contains a concentric circular hole
with a radius of Inner . If Inner is 0, then no hole is generated. The partial
disk is subdivided around the z axis into slices (like pizza slices) and also about
the z axis into rings (as specified by Slices and Loops , respectively).

With respect to orientation, the +z side of the partial disk is considered to
be outside (see glu:quadricOrientation/2 ). This means that if the orientation
is set to ?GLU_OUTSIDE, then any normals generated point along the +z axis.
Otherwise, they point along the -z axis.

If texturing is turned on (with glu:quadricTexture/2 ), texture coordinates are
generated linearly such that where r= outer, the value at (r, 0, 0) is (1.0,
0.5), at (0, r, 0) it is (0.5, 1.0), at (-r, 0, 0) it is (0.0, 0.5), and
at (0, -r, 0) it is (0.5, 0.0).

See external documentation.

perspective(Fovy, Aspect, ZNear, ZFar) -> ok

Fovy = float()

Aspect = float()

ZNear = float()

ZFar = float()

Set up a perspective projection matrix

glu:perspective specifies a viewing frustum into the world coordinate system. In
general, the aspect ratio in glu:perspective should match the aspect ratio of the
associated viewport. For example, aspect= 2.0 means the viewer's angle of view is twice
as wide in x as it is in y. If the viewport is twice as wide as it is tall,
it displays the image without distortion.

The matrix generated by glu:perspective is multipled by the current matrix, just
as if gl:multMatrixd/1 were called with the generated matrix. To load the perspective
matrix onto the current matrix stack instead, precede the call to glu:perspective
with a call to gl:loadIdentity/0 .

pickMatrix(X, Y, DelX, DelY, Viewport) -> ok

X = float()

Y = float()

DelX = float()

DelY = float()

Viewport = {integer(), integer(), integer(), integer()}

Define a picking region

glu:pickMatrix creates a projection matrix that can be used to restrict drawing
to a small region of the viewport. This is typically useful to determine what objects
are being drawn near the cursor. Use glu:pickMatrix to restrict drawing to a small
region around the cursor. Then, enter selection mode (with gl:renderMode/1 ) and
rerender the scene. All primitives that would have been drawn near the cursor are identified
and stored in the selection buffer.

The matrix created by glu:pickMatrix is multiplied by the current matrix just as
if gl:multMatrixd/1 is called with the generated matrix. To effectively use the
generated pick matrix for picking, first call gl:loadIdentity/0 to load an identity
matrix onto the perspective matrix stack. Then call glu:pickMatrix, and, finally,
call a command (such as glu:perspective/4 ) to multiply the perspective matrix by
the pick matrix.

When using glu:pickMatrix to pick NURBS, be careful to turn off the NURBS property
?GLU_AUTO_LOAD_MATRIX. If ?GLU_AUTO_LOAD_MATRIX is not turned off, then
any NURBS surface rendered is subdivided differently with the pick matrix than the way
it was subdivided without the pick matrix.

Note that the interpretation of outward and inward depends on the quadric
being drawn.

See external documentation.

quadricTexture(Quad, Texture) -> ok

Quad = integer()

Texture = 0 | 1

Specify if texturing is desired for quadrics

glu:quadricTexture specifies if texture coordinates should be generated for quadrics
rendered with Quad . If the value of Texture is ?GLU_TRUE, then texture
coordinates are generated, and if Texture is ?GLU_FALSE, they are not.
The initial value is ?GLU_FALSE.

The manner in which texture coordinates are generated depends upon the specific quadric
rendered.

glu:scaleImage scales a pixel image using the appropriate pixel store modes to
unpack data from the source image and pack data into the destination image.

When shrinking an image, glu:scaleImage uses a box filter to sample the source
image and create pixels for the destination image. When magnifying an image, the pixels
from the source image are linearly interpolated to create the destination image.

See the gl:readPixels/7 reference page for a description of the acceptable values
for the Format , TypeIn , and TypeOut parameters.

See external documentation.

sphere(Quad, Radius, Slices, Stacks) -> ok

Quad = integer()

Radius = float()

Slices = integer()

Stacks = integer()

Draw a sphere

glu:sphere draws a sphere of the given radius centered around the origin. The sphere
is subdivided around the z axis into slices and along the z axis into
stacks (similar to lines of longitude and latitude).

If the orientation is set to ?GLU_OUTSIDE (with glu:quadricOrientation/2 ),
then any normals generated point away from the center of the sphere. Otherwise, they
point toward the center of the sphere.

If texturing is turned on (with glu:quadricTexture/2 ), then texture coordinates
are generated so that t ranges from 0.0 at z=-radius to 1.0 at z= radius (t
increases linearly along longitudinal lines), and s ranges from 0.0 at the +y
axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 at the -x
axis, and back to 1.0 at the +y axis.