[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.11 Texture mapping

Defining textures

Function: gl-tex-image-1d target level internalformat width border format type texels
Function: gl-tex-image-2d target level internalformat width height border format type texels
Function: gl-tex-image-3d target level internalformat width height depth border format type texels

Defines an 1D, 2D or 3D texture. 3D texture is available only if the GL version is 1.2 or later. The target parameter can be GL_TEXTURE_1D or GL_PROXY_TEXTURE_1D for gl-tex-image-1d, etc. The level parameter can be used for multiresolution textures; if this is a single resolution texture, pass 0.

Width, height, and depth specify the dimensions of the texture. Border can be 0 or 1, specifying the border.

The actual texture data is passed to the texels argument in a uniform vector, which should be compatible with the format and type parameters and match the size calculated by width, height and depth (and possibly the pixel store setting).

Function: gl-copy-tex-image-1d target level internal-format x y width border
Function: gl-copy-tex-image-2d target level internal-format x y width height border

Cerates a 1D or 2D texture from the framebuffer data.

Function: gl-tex-sub-image-1d target level xoffset width format type texels
Function: gl-tex-sub-image-2d target level xoffset yoffset width height format type texels
Function: gl-tex-sub-image-3d target level xoffset yoffset zoffset width height depth format type texels

Replaces a part of the current 1D, 2D or 3D texture image by texels. 3D texture is available only if the GL version is 1.2 or later.

Function: gl-copy-tex-sub-image-1d target level xoffset x y width
Function: gl-copy-tex-sub-image-2d target level xoffset yoffset x y width height
Function: gl-copy-tex-sub-image-3d target level xoffset yoffset zoffset x y width height

Replaces a part of the current 1D, 2D or 3D texture image by the data from the framebuffer. 3D texture is available only if the GL version is 1.2 or later.

Texture parameters

Function: gl-tex-parameter target pname param

Sets parameters for the current texture. Target can be either GL_TEXTURE_1D, GL_TEXTURE_2D or GL_TEXTURE_3D. Possible values for pname, and accepted type of param for each pname, are shown below.

GL_TEXTURE_WRAP_S
GL_TEXTURE_WRAP_T
GL_TEXTURE_WRAP_R
GL_TEXTURE_BASE_LEVEL
GL_TEXTURE_MAX_LEVEL
GL_TEXTURE_MAG_FILTER
GL_TEXTURE_MIN_FILTER

Param must be an integer.

GL_TEXTURE_PRIORITY
GL_TEXTURE_MIN_LOD
GL_TEXTURE_MAX_LOD

Param must be a real number.

GL_TEXTURE_BORDER_COLOR

Param must be an f32vector of size 4, representing a color.

Function: gl-get-tex-parameter target pname

Obtains the parameter of the current texture, set by gl-tex-parameter.

Function: gl-get-tex-level-parameter target level pname

Obtains the parameter of the level level of the current texture specified by target, which can be either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D, or GL_PROXY_TEXTURE_3D.

Possible values for pname is either one of the following constants: GL_TEXTURE_WIDTH, GL_TEXTURE_HEIGHT, GL_TEXTURE_DEPTH, GL_TEXTURE_BORDER, GL_TEXTURE_INTERNAL_FORMAT, GL_TEXTURE_RED_SIZE, GL_TEXTURE_GREEN_SIZE, GL_TEXTURE_BLUE_SIZE, GL_TEXTURE_ALPHA_SIZE, GL_TEXTURE_LUMINANCE_SIZE, or GL_TEXTURE_INTENSITY_SIZE. This procedure returns an integer.

Mipmaps

Function: glu-build-1d-mipmaps target internal-format width format type texels
Function: glu-build-2d-mipmaps target internal-format width height format type texels
Function: glu-build-3d-mipmaps target internal-format width height depth format type texels

Constructs a serids of mipmaps and calls gl-tex-image-*d to load the images. Returns 0 on success, or a GLU error code on failure. Texels is a uniform vector, that must be compatible with format and type arguments, and must have the enough length as specified by width, height and depth parameters.

Function: glu-build-1d-mipmap-levels target internal-format width format type level base max texels
Function: glu-build-2d-mipmap-levels target internal-format width height format type level base max texels
Function: glu-build-3d-mipmap-levels target internal-format width height depth format type level base max texels

Like glu-build-*d-mipmaps, but you can specify the level of texels, and the range of levels to be generated by the base and max parameters. It is used to generate a subset of mipmaps.

Returns 0 on success, or a GLU error code on failure. Texels is a uniform vector, that must be compatible with format and type arguments, and must have the enough length as specified by width, height and depth parameters.

Texture objects

Function: gl-gen-textures size

Returns size new names for texture objects in a u32vector.

Function: gl-is-texture name

Returns #t if an integer name is the name of a texture that has been bound and not deleted yet, #f otherwise.

Function: gl-bind-texture target name

Bind the current texture (specified by target, e.g. GL_TEXTURE_2D) to the integer name. If there's already a texture bound to name, it becomes current. Otherwise a new texture object is created and made current.

Function: gl-delete-textures names

Delets textures. Names must be a u32vector contains integer names of the texture objects to be deleted.

Function: gl-are-textures-resident! names residences

Names must be a u32vector contains integer names of the texture objects, and residences must be a GL boolean vector of the same length as names. If all textures named in names are resident, #t is returned and residences is not modified. Othewise, #f is returned and residences is modified to contain #t if the corresponding texture in names is resident, #f othewise.

Function: gl-prioritize-textures names priorities

Sets the prioridies of texture objects named by names to the corresponding entry of priorities Names must be a u32vectore and priorities must be an f32vector, and the lengths of both vectors must match.

Texture environment and coordinates

Function: gl-tex-env target pname param

Sets the current texturing function. Target must be GL_TEXTURE_ENV. Possible values of pname and accepted param for each value is as follows.

GL_TEXTURE_ENV_MODE

One of GL_DECAL, GL_REPLACE, GL_MODULATE or GL_BLEND.

GL_TEXTURE_ENV_COLOR

f32vector of size 4 to specify the color.

Function: gl-tex-gen coord pname param

Specifies the functions for automatic texture coordinate generation. Coord specifies the coordinates, either one of GL_S, GL_T, GL_R or GL_Q. Possible values of pname and accepted param for each value is as follows.

GL_TEXTURE_GEN_MODE

Either GL_OBJECT_LINEAR, GL_EYE_LINEAR or GL_SPHERE_MAP.

GL_OBJECT_PLANE
GL_EYE_PLANE

An s32, f32 or f64vector of size 4 to specify the plane.

Multitexturing

Function: gl-active-texture-arb texunit

[GL_ARB_multitexture] Selects the texture unit that is currently modified by texturing routines. Texunit is a constant GL_TEXTUREi_ARB, where i is 0 to the maximum number of the supported texture units.

Function: gl-multi-tex-coord-arb texunit coords
Function: gl-multi-tex-coord-arb texunit s &optional t r q

[GL_ARB_multitexture] Specifies the texture coordinate of the texture unit texunit. In the first form, you can pass either an f32, f64, s32, or s16vector of length 1 to 4. In the second form, s, t, r and q must be real numbers.

Function: gl-client-active-texture-arb texunit

Selects the current texture unit for specifying texutre-coordinate data with vertex arrays.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Shiro Kawai on June, 7 2008 using texi2html 1.78.