See rasterPos2d/2
Types
See rasterPos2d/2
Types
See rasterPos2d/2
Types
See rasterPos2d/2
Types
Equivalent to rasterPos2d(X, Y).
Types
Equivalent to rasterPos2f(X, Y).
Types
Equivalent to rasterPos2i(X, Y).
Types
Equivalent to rasterPos2s(X, Y).
Types
Equivalent to rasterPos3d(X, Y, Z).
Types
Equivalent to rasterPos3f(X, Y, Z).
Types
Equivalent to rasterPos3i(X, Y, Z).
Types
Equivalent to rasterPos3s(X, Y, Z).
Types
Equivalent to rasterPos4d(X, Y, Z, W).
Types
Equivalent to rasterPos4f(X, Y, Z, W).
Types
Equivalent to rasterPos4i(X, Y, Z, W).
Types
Equivalent to rasterPos4s(X, Y, Z, W).
Types
Draw a rectangle
gl:rect supports efficient specification of rectangles as two corner points. Each rectangle command takes four arguments, organized either as two consecutive pairs of (x y) coordinates or as two pointers to arrays, each containing an (x y) pair. The resulting rectangle is defined in the z=0 plane.
gl:rect( X1 , Y1 , X2 , Y2 ) is exactly equivalent to the following sequence: glBegin(?GL_POLYGON); glVertex2( X1 , Y1 ); glVertex2( X2 , Y1 ); glVertex2( X2 , Y2 ); glVertex2( X1 , Y2 ); glEnd(); Note that if the second vertex is above and to the right of the first vertex, the rectangle is constructed with a counterclockwise winding.
See external documentation.
Types
See rectd/4
Types
See rectd/4
Types
See rectd/4
Types
See rectd/4
Types
See rectd/4
Types
See rectd/4
Types
See rectd/4
vertexPointer(Size, Type, Stride, Ptr) -> ok
Define an array of vertex data
gl:vertexPointer specifies the location and data format of an array of vertex coordinates to use when rendering. Size specifies the number of coordinates per vertex, and must be 2, 3, or 4. Type specifies the data type of each coordinate, and Stride specifies the byte stride from one vertex to the next, allowing vertices and attributes to be packed into a single array or stored in separate arrays. (Single-array storage may be more efficient on some implementations; see gl:interleavedArrays/3 .)
If a non-zero named buffer object is bound to the ?GL_ARRAY_BUFFER target (see gl:bindBuffer/2 ) while a vertex array is specified, Pointer is treated as a byte offset into the buffer object's data store. Also, the buffer object binding (?GL_ARRAY_BUFFER_BINDING ) is saved as vertex array client-side state (?GL_VERTEX_ARRAY_BUFFER_BINDING).
When a vertex array is specified, Size , Type , Stride , and Pointer are saved as client-side state, in addition to the current vertex array buffer object binding.
To enable and disable the vertex array, call gl:enableClientState/1 and gl:enableClientState/1 with the argument ?GL_VERTEX_ARRAY. If enabled, the vertex array is used when gl:arrayElement/1 , gl:drawArrays/3 , gl:multiDrawArrays/3 , gl:drawElements/4 , see glMultiDrawElements , or gl:drawRangeElements/6 is called.
See external documentation.
normalPointer(Type, Stride, Ptr) -> ok
Define an array of normals
gl:normalPointer specifies the location and data format of an array of normals to use when rendering. Type specifies the data type of each normal coordinate, and Stride specifies the byte stride from one normal to the next, allowing vertices and attributes to be packed into a single array or stored in separate arrays. (Single-array storage may be more efficient on some implementations; see gl:interleavedArrays/3 .)
If a non-zero named buffer object is bound to the ?GL_ARRAY_BUFFER target (see gl:bindBuffer/2 ) while a normal array is specified, Pointer is treated as a byte offset into the buffer object's data store. Also, the buffer object binding (?GL_ARRAY_BUFFER_BINDING ) is saved as normal vertex array client-side state (?GL_NORMAL_ARRAY_BUFFER_BINDING ).
When a normal array is specified, Type , Stride , and Pointer are saved as client-side state, in addition to the current vertex array buffer object binding.
To enable and disable the normal array, call gl:enableClientState/1 and gl:enableClientState/1 with the argument ?GL_NORMAL_ARRAY. If enabled, the normal array is used when gl:drawArrays/3 , gl:multiDrawArrays/3 , gl:drawElements/4 , see glMultiDrawElements, gl:drawRangeElements/6 , or gl:arrayElement/1 is called.
See external documentation.
colorPointer(Size, Type, Stride, Ptr) -> ok
Define an array of colors
gl:colorPointer specifies the location and data format of an array of color components to use when rendering. Size specifies the number of components per color, and must be 3 or 4. Type specifies the data type of each color component, and Stride specifies the byte stride from one color to the next, allowing vertices and attributes to be packed into a single array or stored in separate arrays. (Single-array storage may be more efficient on some implementations; see gl:interleavedArrays/3 .)
If a non-zero named buffer object is bound to the ?GL_ARRAY_BUFFER target (see gl:bindBuffer/2 ) while a color array is specified, Pointer is treated as a byte offset into the buffer object's data store. Also, the buffer object binding (?GL_ARRAY_BUFFER_BINDING ) is saved as color vertex array client-side state (?GL_COLOR_ARRAY_BUFFER_BINDING).
When a color array is specified, Size , Type , Stride , and Pointer are saved as client-side state, in addition to the current vertex array buffer object binding.
To enable and disable the color array, call gl:enableClientState/1 and gl:enableClientState/1 with the argument ?GL_COLOR_ARRAY. If enabled, the color array is used when gl:drawArrays/3 , gl:multiDrawArrays/3 , gl:drawElements/4 , see glMultiDrawElements, gl:drawRangeElements/6 , or gl:arrayElement/1 is called.
See external documentation.
indexPointer(Type, Stride, Ptr) -> ok
Define an array of color indexes
gl:indexPointer specifies the location and data format of an array of color indexes to use when rendering. Type specifies the data type of each color index and Stride specifies the byte stride from one color index to the next, allowing vertices and attributes to be packed into a single array or stored in separate arrays.
If a non-zero named buffer object is bound to the ?GL_ARRAY_BUFFER target (see gl:bindBuffer/2 ) while a color index array is specified, Pointer is treated as a byte offset into the buffer object's data store. Also, the buffer object binding (?GL_ARRAY_BUFFER_BINDING ) is saved as color index vertex array client-side state (?GL_INDEX_ARRAY_BUFFER_BINDING ).
When a color index array is specified, Type , Stride , and Pointer are saved as client-side state, in addition to the current vertex array buffer object binding.
To enable and disable the color index array, call gl:enableClientState/1 and gl:enableClientState/1 with the argument ?GL_INDEX_ARRAY. If enabled, the color index array is used when gl:drawArrays/3 , gl:multiDrawArrays/3 , gl:drawElements/4 , see glMultiDrawElements , gl:drawRangeElements/6 , or gl:arrayElement/1 is called.
See external documentation.
texCoordPointer(Size, Type, Stride, Ptr) -> ok
Define an array of texture coordinates
gl:texCoordPointer specifies the location and data format of an array of texture coordinates to use when rendering. Size specifies the number of coordinates per texture coordinate set, and must be 1, 2, 3, or 4. Type specifies the data type of each texture coordinate, and Stride specifies the byte stride from one texture coordinate set to the next, allowing vertices and attributes to be packed into a single array or stored in separate arrays. (Single-array storage may be more efficient on some implementations; see gl:interleavedArrays/3 .)
If a non-zero named buffer object is bound to the ?GL_ARRAY_BUFFER target (see gl:bindBuffer/2 ) while a texture coordinate array is specified, Pointer is treated as a byte offset into the buffer object's data store. Also, the buffer object binding (?GL_ARRAY_BUFFER_BINDING ) is saved as texture coordinate vertex array client-side state (?GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING ).
When a texture coordinate array is specified, Size , Type , Stride , and Pointer are saved as client-side state, in addition to the current vertex array buffer object binding.
To enable and disable a texture coordinate array, call gl:enableClientState/1 and gl:enableClientState/1 with the argument ?GL_TEXTURE_COORD_ARRAY. If enabled, the texture coordinate array is used when gl:arrayElement/1 , gl:drawArrays/3 , gl:multiDrawArrays/3 , gl:drawElements/4 , see glMultiDrawElements, or gl:drawRangeElements/6 is called.
See external documentation.
edgeFlagPointer(Stride, Ptr) -> ok
Define an array of edge flags
gl:edgeFlagPointer specifies the location and data format of an array of boolean edge flags to use when rendering. Stride specifies the byte stride from one edge flag to the next, allowing vertices and attributes to be packed into a single array or stored in separate arrays.
If a non-zero named buffer object is bound to the ?GL_ARRAY_BUFFER target (see gl:bindBuffer/2 ) while an edge flag array is specified, Pointer is treated as a byte offset into the buffer object's data store. Also, the buffer object binding (?GL_ARRAY_BUFFER_BINDING ) is saved as edge flag vertex array client-side state (?GL_EDGE_FLAG_ARRAY_BUFFER_BINDING ).
When an edge flag array is specified, Stride and Pointer are saved as client-side state, in addition to the current vertex array buffer object binding.
To enable and disable the edge flag array, call gl:enableClientState/1 and gl:enableClientState/1 with the argument ?GL_EDGE_FLAG_ARRAY. If enabled, the edge flag array is used when gl:drawArrays/3 , gl:multiDrawArrays/3 , gl:drawElements/4 , see glMultiDrawElements , gl:drawRangeElements/6 , or gl:arrayElement/1 is called.
See external documentation.
Types
Render a vertex using the specified vertex array element
gl:arrayElement commands are used within gl:'begin'/1 / gl:'begin'/1 pairs to specify vertex and attribute data for point, line, and polygon primitives. If ?GL_VERTEX_ARRAY is enabled when gl:arrayElement is called, a single vertex is drawn, using vertex and attribute data taken from location I of the enabled arrays. If ?GL_VERTEX_ARRAY is not enabled, no drawing occurs but the attributes corresponding to the enabled arrays are modified.
Use gl:arrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal for each triangle.
Changes made to array data between the execution of gl:'begin'/1 and the corresponding execution of gl:'begin'/1 may affect calls to gl:arrayElement that are made within the same gl:'begin'/1 / gl:'begin'/1 period in nonsequential ways. That is, a call to gl:arrayElement that precedes a change to array data may access the changed data, and a call that follows a change to array data may access original data.
See external documentation.
drawArrays(Mode, First, Count) -> ok
Render primitives from array data
gl:drawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to gl:drawArrays .
When gl:drawArrays is called, it uses Count sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element First . Mode specifies what kind of primitives are constructed and how the array elements construct those primitives.
Vertex attributes that are modified by gl:drawArrays have an unspecified value after gl:drawArrays returns. Attributes that aren't modified remain well defined.
See external documentation.
drawElements(Mode, Count, Type, Indices) -> ok
Render primitives from array data
gl:drawElements specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL function to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and so on, and use them to construct a sequence of primitives with a single call to gl:drawElements .
When gl:drawElements is called, it uses Count sequential elements from an enabled array, starting at Indices to construct a sequence of geometric primitives. Mode specifies what kind of primitives are constructed and how the array elements construct these primitives. If more than one array is enabled, each is used.
Vertex attributes that are modified by gl:drawElements have an unspecified value after gl:drawElements returns. Attributes that aren't modified maintain their previous values.
See external documentation.
interleavedArrays(Format, Stride, Pointer) -> ok
Simultaneously specify and enable several interleaved arrays
gl:interleavedArrays lets you specify and enable individual color, normal, texture and vertex arrays whose elements are part of a larger aggregate array element. For some implementations, this is more efficient than specifying the arrays separately.
If Stride is 0, the aggregate elements are stored consecutively. Otherwise, Stride bytes occur between the beginning of one aggregate array element and the beginning of the next aggregate array element.
Format serves as a key describing the extraction of individual arrays from the aggregate array. If Format contains a T, then texture coordinates are extracted from the interleaved array. If C is present, color values are extracted. If N is present, normal coordinates are extracted. Vertex coordinates are always extracted.
The digits 2, 3, and 4 denote how many values are extracted. F indicates that values are extracted as floating-point values. Colors may also be extracted as 4 unsigned bytes if 4UB follows the C. If a color is extracted as 4 unsigned bytes, the vertex array element which follows is located at the first possible floating-point aligned address.
See external documentation.
Types
Select flat or smooth shading
GL primitives can have either flat or smooth shading. Smooth shading, the default, causes the computed colors of vertices to be interpolated as the primitive is rasterized, typically assigning different colors to each resulting pixel fragment. Flat shading selects the computed color of just one vertex and assigns it to all the pixel fragments generated by rasterizing a single primitive. In either case, the computed color of a vertex is the result of lighting if lighting is enabled, or it is the current color at the time the vertex was specified if lighting is disabled.
Flat and smooth shading are indistinguishable for points. Starting when gl:'begin'/1 is issued and counting vertices and primitives from 1, the GL gives each flat-shaded line segment i the computed color of vertex i+1, its second vertex. Counting similarly from 1, the GL gives each flat-shaded polygon the computed color of the vertex listed in the following table. This is the last vertex to specify the polygon in all cases except single polygons, where the first vertex specifies the flat-shaded color.
Primitive Type of Polygon iVertexSingle polygon ( i== 1) 1
Triangle strip i+2
Triangle fan i+2
Independent triangle 3 i
Quad strip 2 i+2
Independent quad 4 i
Flat and smooth shading are specified by gl:shadeModel with Mode set to ?GL_FLAT and ?GL_SMOOTH, respectively.
See external documentation.
lightf(Light, Pname, Param) -> ok
Set light source parameters
gl:light sets the values of individual light source parameters. Light names the light and is a symbolic name of the form ?GL_LIGHT i, where i ranges from 0 to the value of ?GL_MAX_LIGHTS - 1. Pname specifies one of ten light source parameters, again by symbolic name. Params is either a single value or a pointer to an array that contains the new values.
To enable and disable lighting calculation, call gl:enable/1 and gl:enable/1 with argument ?GL_LIGHTING. Lighting is initially disabled. When it is enabled, light sources that are enabled contribute to the lighting calculation. Light source i is enabled and disabled using gl:enable/1 and gl:enable/1 with argument ?GL_LIGHT i.
The ten light parameters are as follows:
?GL_AMBIENT: Params contains four integer or floating-point values that specify the ambient RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient light intensity is (0, 0, 0, 1).
?GL_DIFFUSE: Params contains four integer or floating-point values that specify the diffuse RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial value for ?GL_LIGHT0 is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 1).
?GL_SPECULAR: Params contains four integer or floating-point values that specify the specular RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial value for ?GL_LIGHT0 is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 1).
?GL_POSITION: Params contains four integer or floating-point values that specify the position of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped.
The position is transformed by the modelview matrix when gl:light is called (just as if it were a point), and it is stored in eye coordinates. If the w component of the position is 0, the light is treated as a directional source. Diffuse and specular lighting calculations take the light's direction, but not its actual position, into account, and attenuation is disabled. Otherwise, diffuse and specular lighting calculations are based on the actual location of the light in eye coordinates, and attenuation is enabled. The initial position is (0, 0, 1, 0); thus, the initial light source is directional, parallel to, and in the direction of the -z axis.
?GL_SPOT_DIRECTION: Params contains three integer or floating-point values that specify the direction of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped.
The spot direction is transformed by the upper 3x3 of the modelview matrix when gl:light is called, and it is stored in eye coordinates. It is significant only when ?GL_SPOT_CUTOFF is not 180, which it is initially. The initial direction is (0 0 -1).
?GL_SPOT_EXPONENT: Params is a single integer or floating-point value that specifies the intensity distribution of the light. Integer and floating-point values are mapped directly. Only values in the range [0 128] are accepted.
Effective light intensity is attenuated by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lighted, raised to the power of the spot exponent. Thus, higher spot exponents result in a more focused light source, regardless of the spot cutoff angle (see ?GL_SPOT_CUTOFF, next paragraph). The initial spot exponent is 0, resulting in uniform light distribution.
?GL_SPOT_CUTOFF: Params is a single integer or floating-point value that specifies the maximum spread angle of a light source. Integer and floating-point values are mapped directly. Only values in the range [0 90] and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the vertex being lighted is greater than the spot cutoff angle, the light is completely masked. Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The initial spot cutoff is 180, resulting in uniform light distribution.
?GL_CONSTANT_ATTENUATION
?GL_LINEAR_ATTENUATION
?GL_QUADRATIC_ATTENUATION: Params is a single integer or floating-point value that specifies one of the three light attenuation factors. Integer and floating-point values are mapped directly. Only nonnegative values are accepted. If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant factor, the linear factor times the distance between the light and the vertex being lighted, and the quadratic factor times the square of the same distance. The initial attenuation factors are (1, 0, 0), resulting in no attenuation.
See external documentation.
lighti(Light, Pname, Param) -> ok
See lightf/3
lightfv(Light, Pname, Params) -> ok
See lightf/3
lightiv(Light, Pname, Params) -> ok
See lightf/3
getLightfv(Light, Pname) -> {float(), float(), float(), float()}
Return light source parameter values
gl:getLight returns in Params the value or values of a light source parameter. Light names the light and is a symbolic name of the form ?GL_LIGHT i where i ranges from 0 to the value of ?GL_MAX_LIGHTS - 1. ?GL_MAX_LIGHTS is an implementation dependent constant that is greater than or equal to eight. Pname specifies one of ten light source parameters, again by symbolic name.
The following parameters are defined:
?GL_AMBIENT: Params returns four integer or floating-point values representing the ambient intensity of the light source. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value is (0, 0, 0, 1).
?GL_DIFFUSE: Params returns four integer or floating-point values representing the diffuse intensity of the light source. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value for ?GL_LIGHT0 is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0).
?GL_SPECULAR: Params returns four integer or floating-point values representing the specular intensity of the light source. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value for ?GL_LIGHT0 is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0).
?GL_POSITION: Params returns four integer or floating-point values representing the position of the light source. Integer values, when requested, are computed by rounding the internal floating-point values to the nearest integer value. The returned values are those maintained in eye coordinates. They will not be equal to the values specified using gl:lightf/3 , unless the modelview matrix was identity at the time gl:lightf/3 was called. The initial value is (0, 0, 1, 0).
?GL_SPOT_DIRECTION: Params returns three integer or floating-point values representing the direction of the light source. Integer values, when requested, are computed by rounding the internal floating-point values to the nearest integer value. The returned values are those maintained in eye coordinates. They will not be equal to the values specified using gl:lightf/3 , unless the modelview matrix was identity at the time gl:lightf/3 was called. Although spot direction is normalized before being used in the lighting equation, the returned values are the transformed versions of the specified values prior to normalization. The initial value is (0 0 -1).
?GL_SPOT_EXPONENT: Params returns a single integer or floating-point value representing the spot exponent of the light. An integer value, when requested, is computed by rounding the internal floating-point representation to the nearest integer. The initial value is 0.
?GL_SPOT_CUTOFF: Params returns a single integer or floating-point value representing the spot cutoff angle of the light. An integer value, when requested, is computed by rounding the internal floating-point representation to the nearest integer. The initial value is 180.
?GL_CONSTANT_ATTENUATION: Params returns a single integer or floating-point value representing the constant (not distance-related) attenuation of the light. An integer value, when requested, is computed by rounding the internal floating-point representation to the nearest integer. The initial value is 1.
?GL_LINEAR_ATTENUATION: Params returns a single integer or floating-point value representing the linear attenuation of the light. An integer value, when requested, is computed by rounding the internal floating-point representation to the nearest integer. The initial value is 0.
?GL_QUADRATIC_ATTENUATION: Params returns a single integer or floating-point value representing the quadratic attenuation of the light. An integer value, when requested, is computed by rounding the internal floating-point representation to the nearest integer. The initial value is 0.
See external documentation.
getLightiv(Light, Pname) -> {integer(), integer(), integer(), integer()}
See getLightfv/2
lightModelf(Pname, Param) -> ok
Set the lighting model parameters
gl:lightModel sets the lighting model parameter. Pname names a parameter and Params gives the new value. There are three lighting model parameters:
?GL_LIGHT_MODEL_AMBIENT: Params contains four integer or floating-point values that specify the ambient RGBA intensity of the entire scene. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient scene intensity is (0.2, 0.2, 0.2, 1.0).
?GL_LIGHT_MODEL_COLOR_CONTROL: Params must be either ?GL_SEPARATE_SPECULAR_COLOR or ?GL_SINGLE_COLOR. ?GL_SINGLE_COLOR specifies that a single color is generated from the lighting computation for a vertex. ?GL_SEPARATE_SPECULAR_COLOR specifies that the specular color computation of lighting be stored separately from the remainder of the lighting computation. The specular color is summed into the generated fragment's color after the application of texture mapping (if enabled). The initial value is ?GL_SINGLE_COLOR.
?GL_LIGHT_MODEL_LOCAL_VIEWER: Params is a single integer or floating-point value that specifies how specular reflection angles are computed. If Params is 0 (or 0.0), specular reflection angles take the view direction to be parallel to and in the direction of the -z axis, regardless of the location of the vertex in eye coordinates. Otherwise, specular reflections are computed from the origin of the eye coordinate system. The initial value is 0.
?GL_LIGHT_MODEL_TWO_SIDE: Params is a single integer or floating-point value that specifies whether one- or two-sided lighting calculations are done for polygons. It has no effect on the lighting calculations for points, lines, or bitmaps. If Params is 0 (or 0.0), one-sided lighting is specified, and only the front material parameters are used in the lighting equation. Otherwise, two-sided lighting is specified. In this case, vertices of back-facing polygons are lighted using the back material parameters and have their normals reversed before the lighting equation is evaluated. Vertices of front-facing polygons are always lighted using the front material parameters, with no change to their normals. The initial value is 0.
In RGBA mode, the lighted color of a vertex is the sum of the material emission intensity, the product of the material ambient reflectance and the lighting model full-scene ambient intensity, and the contribution of each enabled light source. Each light source contributes the sum of three terms: ambient, diffuse, and specular. The ambient light source contribution is the product of the material ambient reflectance and the light's ambient intensity. The diffuse light source contribution is the product of the material diffuse reflectance, the light's diffuse intensity, and the dot product of the vertex's normal with the normalized vector from the vertex to the light source. The specular light source contribution is the product of the material specular reflectance, the light's specular intensity, and the dot product of the normalized vertex-to-eye and vertex-to-light vectors, raised to the power of the shininess of the material. All three light source contributions are attenuated equally based on the distance from the vertex to the light source and on light source direction, spread exponent, and spread cutoff angle. All dot products are replaced with 0 if they evaluate to a negative value.
The alpha component of the resulting lighted color is set to the alpha value of the material diffuse reflectance.
In color index mode, the value of the lighted index of a vertex ranges from the ambient to the specular values passed to gl:materialf/3 using ?GL_COLOR_INDEXES. Diffuse and specular coefficients, computed with a (.30, .59, .11) weighting of the lights' colors, the shininess of the material, and the same reflection and attenuation equations as in the RGBA case, determine how much above ambient the resulting index is.
See external documentation.
lightModeli(Pname, Param) -> ok
See lightModelf/2
lightModelfv(Pname, Params) -> ok
See lightModelf/2
lightModeliv(Pname, Params) -> ok
See lightModelf/2
materialf(Face, Pname, Param) -> ok
Specify material parameters for the lighting model
gl:material assigns values to material parameters. There are two matched sets of material parameters. One, the front-facing set, is used to shade points, lines, bitmaps, and all polygons (when two-sided lighting is disabled), or just front-facing polygons (when two-sided lighting is enabled). The other set, back-facing, is used to shade back-facing polygons only when two-sided lighting is enabled. Refer to the gl:lightModelf/2 reference page for details concerning one- and two-sided lighting calculations.
gl:material takes three arguments. The first, Face , specifies whether the ?GL_FRONT materials, the ?GL_BACK materials, or both ?GL_FRONT_AND_BACK materials will be modified. The second, Pname , specifies which of several parameters in one or both sets will be modified. The third, Params , specifies what value or values will be assigned to the specified parameter.
Material parameters are used in the lighting equation that is optionally applied to each vertex. The equation is discussed in the gl:lightModelf/2 reference page. The parameters that can be specified using gl:material, and their interpretations by the lighting equation, are as follows:
?GL_AMBIENT: Params contains four integer or floating-point values that specify the ambient RGBA reflectance of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient reflectance for both front- and back-facing materials is (0.2, 0.2, 0.2, 1.0).
?GL_DIFFUSE: Params contains four integer or floating-point values that specify the diffuse RGBA reflectance of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial diffuse reflectance for both front- and back-facing materials is (0.8, 0.8, 0.8, 1.0).
?GL_SPECULAR: Params contains four integer or floating-point values that specify the specular RGBA reflectance of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial specular reflectance for both front- and back-facing materials is (0, 0, 0, 1).
?GL_EMISSION: Params contains four integer or floating-point values that specify the RGBA emitted light intensity of the material. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial emission intensity for both front- and back-facing materials is (0, 0, 0, 1).
?GL_SHININESS: Params is a single integer or floating-point value that specifies the RGBA specular exponent of the material. Integer and floating-point values are mapped directly. Only values in the range [0 128] are accepted. The initial specular exponent for both front- and back-facing materials is 0.
?GL_AMBIENT_AND_DIFFUSE: Equivalent to calling gl:material twice with the same parameter values, once with ?GL_AMBIENT and once with ?GL_DIFFUSE.
?GL_COLOR_INDEXES: Params contains three integer or floating-point values specifying the color indices for ambient, diffuse, and specular lighting. These three values, and ?GL_SHININESS, are the only material values used by the color index mode lighting equation. Refer to the gl:lightModelf/2 reference page for a discussion of color index lighting.
See external documentation.
materiali(Face, Pname, Param) -> ok
See materialf/3
materialfv(Face, Pname, Params) -> ok
See materialf/3
materialiv(Face, Pname, Params) -> ok
See materialf/3
getMaterialfv(Face, Pname) -> {float(), float(), float(), float()}
Return material parameters
gl:getMaterial returns in Params the value or values of parameter Pname of material Face . Six parameters are defined:
?GL_AMBIENT: Params returns four integer or floating-point values representing the ambient reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value is (0.2, 0.2, 0.2, 1.0)
?GL_DIFFUSE: Params returns four integer or floating-point values representing the diffuse reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value is (0.8, 0.8, 0.8, 1.0).
?GL_SPECULAR: Params returns four integer or floating-point values representing the specular reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value is (0, 0, 0, 1).
?GL_EMISSION: Params returns four integer or floating-point values representing the emitted light intensity of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and -1.0 maps to the most negative representable integer value. If the internal value is outside the range [-1 1], the corresponding integer return value is undefined. The initial value is (0, 0, 0, 1).
?GL_SHININESS: Params returns one integer or floating-point value representing the specular exponent of the material. Integer values, when requested, are computed by rounding the internal floating-point value to the nearest integer value. The initial value is 0.
?GL_COLOR_INDEXES: Params returns three integer or floating-point values representing the ambient, diffuse, and specular indices of the material. These indices are used only for color index lighting. (All the other parameters are used only for RGBA lighting.) Integer values, when requested, are computed by rounding the internal floating-point values to the nearest integer values.
See external documentation.
getMaterialiv(Face, Pname) -> {integer(), integer(), integer(), integer()}
See getMaterialfv/2
colorMaterial(Face, Mode) -> ok
Cause a material color to track the current color
gl:colorMaterial specifies which material parameters track the current color. When ?GL_COLOR_MATERIAL is enabled, the material parameter or parameters specified by Mode , of the material or materials specified by Face , track the current color at all times.
To enable and disable ?GL_COLOR_MATERIAL, call gl:enable/1 and gl:enable/1 with argument ?GL_COLOR_MATERIAL. ?GL_COLOR_MATERIAL is initially disabled.
See external documentation.
pixelZoom(Xfactor, Yfactor) -> ok
Types
Specify the pixel zoom factors
gl:pixelZoom specifies values for the x and y zoom factors. During the execution of gl:drawPixels/5 or gl:copyPixels/5 , if ( xr, yr) is the current raster position, and a given element is in the mth row and nth column of the pixel rectangle, then pixels whose centers are in the rectangle with corners at
( xr+n. xfactor, yr+m. yfactor)
( xr+(n+1). xfactor, yr+(m+1). yfactor)
are candidates for replacement. Any pixel whose center lies on the bottom or left edge of this rectangular region is also modified.
Pixel zoom factors are not limited to positive values. Negative zoom factors reflect the resulting image about the current raster position.
See external documentation.
pixelStoref(Pname, Param) -> ok
Set pixel storage modes
gl:pixelStore sets pixel storage modes that affect the operation of subsequent gl:readPixels/7 as well as the unpacking of texture patterns (see gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , gl:texSubImage1D/7 ), gl:compressedTexImage1D/7 , gl:compressedTexImage2D/8 , gl:compressedTexImage3D/9 , gl:compressedTexSubImage1D/7 , gl:compressedTexSubImage2D/9 or gl:compressedTexSubImage1D/7 .
Pname is a symbolic constant indicating the parameter to be set, and Param is the new value. Six of the twelve storage parameters affect how pixel data is returned to client memory. They are as follows:
?GL_PACK_SWAP_BYTES: If true, byte ordering for multibyte color components, depth components, or stencil indices is reversed. That is, if a four-byte component consists of bytes b 0, b 1, b 2, b 3, it is stored in memory as b 3, b 2, b 1, b 0 if ?GL_PACK_SWAP_BYTES is true. ?GL_PACK_SWAP_BYTES has no effect on the memory order of components within a pixel, only on the order of bytes within components or indices. For example, the three components of a ?GL_RGB format pixel are always stored with red first, green second, and blue third, regardless of the value of ?GL_PACK_SWAP_BYTES.
?GL_PACK_LSB_FIRST: If true, bits are ordered within a byte from least significant to most significant; otherwise, the first bit in each byte is the most significant one.
?GL_PACK_ROW_LENGTH: If greater than 0, ?GL_PACK_ROW_LENGTH defines the number of pixels in a row. If the first pixel of a row is placed at location p in memory, then the location of the first pixel of the next row is obtained by skipping
k={n l(a/s) |(s n l)/a| s>= a s< a)
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (?GL_PACK_ROW_LENGTH if it is greater than 0, the width argument to the pixel routine otherwise), a is the value of ?GL_PACK_ALIGNMENT , and s is the size, in bytes, of a single component (if a< s, then it is as if a= s). In the case of 1-bit values, the location of the next row is obtained by skipping
k=8 a |(n l)/(8 a)|
components or indices.
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format ?GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
?GL_PACK_IMAGE_HEIGHT: If greater than 0, ?GL_PACK_IMAGE_HEIGHT defines the number of pixels in an image three-dimensional texture volume, where image is defined by all pixels sharing the same third dimension index. If the first pixel of a row is placed at location p in memory, then the location of the first pixel of the next row is obtained by skipping
k={n l h(a/s) |(s n l h)/a| s>= a s< a)
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (?GL_PACK_ROW_LENGTH if it is greater than 0, the width argument to gl:texImage3D/10 otherwise), h is the number of rows in a pixel image (?GL_PACK_IMAGE_HEIGHT if it is greater than 0, the height argument to the gl:texImage3D/10 routine otherwise), a is the value of ?GL_PACK_ALIGNMENT , and s is the size, in bytes, of a single component (if a< s, then it is as if a=s).
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format ?GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
?GL_PACK_SKIP_PIXELS, ?GL_PACK_SKIP_ROWS, and ?GL_PACK_SKIP_IMAGES
These values are provided as a convenience to the programmer; they provide no functionality that cannot be duplicated simply by incrementing the pointer passed to gl:readPixels/7 . Setting ?GL_PACK_SKIP_PIXELS to i is equivalent to incrementing the pointer by i n components or indices, where n is the number of components or indices in each pixel. Setting ?GL_PACK_SKIP_ROWS to j is equivalent to incrementing the pointer by j m components or indices, where m is the number of components or indices per row, as just computed in the ?GL_PACK_ROW_LENGTH section. Setting ?GL_PACK_SKIP_IMAGES to k is equivalent to incrementing the pointer by k p, where p is the number of components or indices per image, as computed in the ?GL_PACK_IMAGE_HEIGHT section.
?GL_PACK_ALIGNMENT: Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
The other six of the twelve storage parameters affect how pixel data is read from client memory. These values are significant for gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , and gl:texSubImage1D/7
They are as follows:
?GL_UNPACK_SWAP_BYTES: If true, byte ordering for multibyte color components, depth components, or stencil indices is reversed. That is, if a four-byte component consists of bytes b 0, b 1, b 2, b 3, it is taken from memory as b 3, b 2, b 1, b 0 if ?GL_UNPACK_SWAP_BYTES is true. ?GL_UNPACK_SWAP_BYTES has no effect on the memory order of components within a pixel, only on the order of bytes within components or indices. For example, the three components of a ?GL_RGB format pixel are always stored with red first, green second, and blue third, regardless of the value of ?GL_UNPACK_SWAP_BYTES.
?GL_UNPACK_LSB_FIRST: If true, bits are ordered within a byte from least significant to most significant; otherwise, the first bit in each byte is the most significant one.
?GL_UNPACK_ROW_LENGTH: If greater than 0, ?GL_UNPACK_ROW_LENGTH defines the number of pixels in a row. If the first pixel of a row is placed at location p in memory, then the location of the first pixel of the next row is obtained by skipping
k={n l(a/s) |(s n l)/a| s>= a s< a)
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (?GL_UNPACK_ROW_LENGTH if it is greater than 0, the width argument to the pixel routine otherwise), a is the value of ?GL_UNPACK_ALIGNMENT , and s is the size, in bytes, of a single component (if a< s, then it is as if a= s). In the case of 1-bit values, the location of the next row is obtained by skipping
k=8 a |(n l)/(8 a)|
components or indices.
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format ?GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
?GL_UNPACK_IMAGE_HEIGHT: If greater than 0, ?GL_UNPACK_IMAGE_HEIGHT defines the number of pixels in an image of a three-dimensional texture volume. Where image is defined by all pixel sharing the same third dimension index. If the first pixel of a row is placed at location p in memory, then the location of the first pixel of the next row is obtained by skipping
k={n l h(a/s) |(s n l h)/a| s>= a s< a)
components or indices, where n is the number of components or indices in a pixel, l is the number of pixels in a row (?GL_UNPACK_ROW_LENGTH if it is greater than 0, the width argument to gl:texImage3D/10 otherwise), h is the number of rows in an image (?GL_UNPACK_IMAGE_HEIGHT if it is greater than 0, the height argument to gl:texImage3D/10 otherwise), a is the value of ?GL_UNPACK_ALIGNMENT, and s is the size, in bytes, of a single component (if a< s, then it is as if a=s).
The word component in this description refers to the nonindex values red, green, blue, alpha, and depth. Storage format ?GL_RGB, for example, has three components per pixel: first red, then green, and finally blue.
?GL_UNPACK_SKIP_PIXELS and ?GL_UNPACK_SKIP_ROWS
These values are provided as a convenience to the programmer; they provide no functionality that cannot be duplicated by incrementing the pointer passed to gl:texImage1D/8 , gl:texImage2D/9 , gl:texSubImage1D/7 or gl:texSubImage1D/7 . Setting ?GL_UNPACK_SKIP_PIXELS to i is equivalent to incrementing the pointer by i n components or indices, where n is the number of components or indices in each pixel. Setting ?GL_UNPACK_SKIP_ROWS to j is equivalent to incrementing the pointer by j k components or indices, where k is the number of components or indices per row, as just computed in the ?GL_UNPACK_ROW_LENGTH section.
?GL_UNPACK_ALIGNMENT: Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
The following table gives the type, initial value, and range of valid values for each storage parameter that can be set with gl:pixelStore.
Pname TypeInitial Value Valid Range?GL_PACK_SWAP_BYTES boolean false true or false
?GL_PACK_LSB_FIRST boolean false true or false
?GL_PACK_ROW_LENGTH integer 0 [0)
?GL_PACK_IMAGE_HEIGHT integer 0 [0)
?GL_PACK_SKIP_ROWS integer 0 [0)
?GL_PACK_SKIP_PIXELS integer 0 [0)
?GL_PACK_SKIP_IMAGES integer 0 [0)
?GL_PACK_ALIGNMENT integer 4 1, 2, 4, or 8
?GL_UNPACK_SWAP_BYTES boolean false true or false
?GL_UNPACK_LSB_FIRST boolean false true or false
?GL_UNPACK_ROW_LENGTH integer 0 [0)
?GL_UNPACK_IMAGE_HEIGHT integer 0 [0)
?GL_UNPACK_SKIP_ROWS integer 0 [0)
?GL_UNPACK_SKIP_PIXELS integer 0 [0)
?GL_UNPACK_SKIP_IMAGES integer 0 [0)
?GL_UNPACK_ALIGNMENT integer 4 1, 2, 4, or 8
gl:pixelStoref can be used to set any pixel store parameter. If the parameter type is boolean, then if Param is 0, the parameter is false; otherwise it is set to true. If Pname is a integer type parameter, Param is rounded to the nearest integer.
Likewise, gl:pixelStorei can also be used to set any of the pixel store parameters. Boolean parameters are set to false if Param is 0 and true otherwise.
See external documentation.
pixelStorei(Pname, Param) -> ok
See pixelStoref/2
pixelTransferf(Pname, Param) -> ok
Set pixel transfer modes
gl:pixelTransfer sets pixel transfer modes that affect the operation of subsequent gl:copyPixels/5 , gl:copyTexImage1D/7 , gl:copyTexImage2D/8 , gl:copyTexSubImage1D/6 , gl:copyTexSubImage2D/8 , gl:copyTexSubImage3D/9 , gl:drawPixels/5 , gl:readPixels/7 , gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , and gl:texSubImage1D/7 commands. Additionally, if the ARB_imaging subset is supported, the routines gl:colorTable/6 , gl:colorSubTable/6 , gl:convolutionFilter1D/6 , gl:convolutionFilter2D/7 , gl:histogram/4 , gl:minmax/3 , and gl:separableFilter2D/8 are also affected. The algorithms that are specified by pixel transfer modes operate on pixels after they are read from the frame buffer ( gl:copyPixels/5 gl:copyTexImage1D/7 , gl:copyTexImage2D/8 , gl:copyTexSubImage1D/6 , gl:copyTexSubImage2D/8 , gl:copyTexSubImage3D/9 , and gl:readPixels/7 ), or unpacked from client memory ( gl:drawPixels/5 , gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , and gl:texSubImage1D/7 ). Pixel transfer operations happen in the same order, and in the same manner, regardless of the command that resulted in the pixel operation. Pixel storage modes (see gl:pixelStoref/2 ) control the unpacking of pixels being read from client memory and the packing of pixels being written back into client memory.
Pixel transfer operations handle four fundamental pixel types: color, color index , depth, and stencil. Color pixels consist of four floating-point values with unspecified mantissa and exponent sizes, scaled such that 0 represents zero intensity and 1 represents full intensity. Color indices comprise a single fixed-point value, with unspecified precision to the right of the binary point. Depth pixels comprise a single floating-point value, with unspecified mantissa and exponent sizes, scaled such that 0.0 represents the minimum depth buffer value, and 1.0 represents the maximum depth buffer value. Finally, stencil pixels comprise a single fixed-point value, with unspecified precision to the right of the binary point.
The pixel transfer operations performed on the four basic pixel types are as follows:
Color: Each of the four color components is multiplied by a scale factor, then added to a bias factor. That is, the red component is multiplied by ?GL_RED_SCALE, then added to ?GL_RED_BIAS; the green component is multiplied by ?GL_GREEN_SCALE , then added to ?GL_GREEN_BIAS; the blue component is multiplied by ?GL_BLUE_SCALE , then added to ?GL_BLUE_BIAS; and the alpha component is multiplied by ?GL_ALPHA_SCALE , then added to ?GL_ALPHA_BIAS. After all four color components are scaled and biased, each is clamped to the range [0 1]. All color, scale, and bias values are specified with gl:pixelTransfer.
If ?GL_MAP_COLOR is true, each color component is scaled by the size of the corresponding color-to-color map, then replaced by the contents of that map indexed by the scaled component. That is, the red component is scaled by ?GL_PIXEL_MAP_R_TO_R_SIZE, then replaced by the contents of ?GL_PIXEL_MAP_R_TO_R indexed by itself. The green component is scaled by ?GL_PIXEL_MAP_G_TO_G_SIZE, then replaced by the contents of ?GL_PIXEL_MAP_G_TO_G indexed by itself. The blue component is scaled by ?GL_PIXEL_MAP_B_TO_B_SIZE, then replaced by the contents of ?GL_PIXEL_MAP_B_TO_B indexed by itself. And the alpha component is scaled by ?GL_PIXEL_MAP_A_TO_A_SIZE, then replaced by the contents of ?GL_PIXEL_MAP_A_TO_A indexed by itself. All components taken from the maps are then clamped to the range [0 1]. ?GL_MAP_COLOR is specified with gl:pixelTransfer. The contents of the various maps are specified with gl:pixelMapfv/3 .
If the ARB_imaging extension is supported, each of the four color components may be scaled and biased after transformation by the color matrix. That is, the red component is multiplied by ?GL_POST_COLOR_MATRIX_RED_SCALE, then added to ?GL_POST_COLOR_MATRIX_RED_BIAS ; the green component is multiplied by ?GL_POST_COLOR_MATRIX_GREEN_SCALE, then added to ?GL_POST_COLOR_MATRIX_GREEN_BIAS; the blue component is multiplied by ?GL_POST_COLOR_MATRIX_BLUE_SCALE , then added to ?GL_POST_COLOR_MATRIX_BLUE_BIAS; and the alpha component is multiplied by ?GL_POST_COLOR_MATRIX_ALPHA_SCALE, then added to ?GL_POST_COLOR_MATRIX_ALPHA_BIAS . After all four color components are scaled and biased, each is clamped to the range [0 1].
Similarly, if the ARB_imaging extension is supported, each of the four color components may be scaled and biased after processing by the enabled convolution filter. That is, the red component is multiplied by ?GL_POST_CONVOLUTION_RED_SCALE, then added to ?GL_POST_CONVOLUTION_RED_BIAS ; the green component is multiplied by ?GL_POST_CONVOLUTION_GREEN_SCALE, then added to ?GL_POST_CONVOLUTION_GREEN_BIAS; the blue component is multiplied by ?GL_POST_CONVOLUTION_BLUE_SCALE , then added to ?GL_POST_CONVOLUTION_BLUE_BIAS; and the alpha component is multiplied by ?GL_POST_CONVOLUTION_ALPHA_SCALE, then added to ?GL_POST_CONVOLUTION_ALPHA_BIAS . After all four color components are scaled and biased, each is clamped to the range [0 1].
Color index: Each color index is shifted left by ?GL_INDEX_SHIFT bits; any bits beyond the number of fraction bits carried by the fixed-point index are filled with zeros. If ?GL_INDEX_SHIFT is negative, the shift is to the right, again zero filled. Then ?GL_INDEX_OFFSET is added to the index. ?GL_INDEX_SHIFT and ?GL_INDEX_OFFSET are specified with gl:pixelTransfer.
From this point, operation diverges depending on the required format of the resulting pixels. If the resulting pixels are to be written to a color index buffer, or if they are being read back to client memory in ?GL_COLOR_INDEX format, the pixels continue to be treated as indices. If ?GL_MAP_COLOR is true, each index is masked by 2 n-1 , where n is ?GL_PIXEL_MAP_I_TO_I_SIZE, then replaced by the contents of ?GL_PIXEL_MAP_I_TO_I indexed by the masked value. ?GL_MAP_COLOR is specified with gl:pixelTransfer . The contents of the index map is specified with gl:pixelMapfv/3 .
If the resulting pixels are to be written to an RGBA color buffer, or if they are read back to client memory in a format other than ?GL_COLOR_INDEX, the pixels are converted from indices to colors by referencing the four maps ?GL_PIXEL_MAP_I_TO_R, ?GL_PIXEL_MAP_I_TO_G , ?GL_PIXEL_MAP_I_TO_B, and ?GL_PIXEL_MAP_I_TO_A. Before being dereferenced, the index is masked by 2 n-1, where n is ?GL_PIXEL_MAP_I_TO_R_SIZE for the red map, ?GL_PIXEL_MAP_I_TO_G_SIZE for the green map, ?GL_PIXEL_MAP_I_TO_B_SIZE for the blue map, and ?GL_PIXEL_MAP_I_TO_A_SIZE for the alpha map. All components taken from the maps are then clamped to the range [0 1]. The contents of the four maps is specified with gl:pixelMapfv/3 .
Depth: Each depth value is multiplied by ?GL_DEPTH_SCALE, added to ?GL_DEPTH_BIAS , then clamped to the range [0 1].
Stencil: Each index is shifted ?GL_INDEX_SHIFT bits just as a color index is, then added to ?GL_INDEX_OFFSET. If ?GL_MAP_STENCIL is true, each index is masked by 2 n-1, where n is ?GL_PIXEL_MAP_S_TO_S_SIZE, then replaced by the contents of ?GL_PIXEL_MAP_S_TO_S indexed by the masked value.
The following table gives the type, initial value, and range of valid values for each of the pixel transfer parameters that are set with gl:pixelTransfer.
Pname TypeInitial Value Valid Range?GL_MAP_COLOR boolean false true/false
?GL_MAP_STENCIL boolean false true/false
?GL_INDEX_SHIFT integer 0 (-)
?GL_INDEX_OFFSET integer 0 (-)
?GL_RED_SCALE float 1 (-)
?GL_GREEN_SCALE float 1 (-)
?GL_BLUE_SCALE float 1 (-)
?GL_ALPHA_SCALE float 1 (-)
?GL_DEPTH_SCALE float 1 (-)
?GL_RED_BIAS float 0 (-)
?GL_GREEN_BIAS float 0 (-)
?GL_BLUE_BIAS float 0 (-)
?GL_ALPHA_BIAS float 0 (-)
?GL_DEPTH_BIAS float 0 (-)
?GL_POST_COLOR_MATRIX_RED_SCALE float 1 (-)
?GL_POST_COLOR_MATRIX_GREEN_SCALE float 1 (-)
?GL_POST_COLOR_MATRIX_BLUE_SCALE float 1 (-)
?GL_POST_COLOR_MATRIX_ALPHA_SCALE float 1 (-)
?GL_POST_COLOR_MATRIX_RED_BIAS float 0 (-)
?GL_POST_COLOR_MATRIX_GREEN_BIAS float 0 (-)
?GL_POST_COLOR_MATRIX_BLUE_BIAS float 0 (-)
?GL_POST_COLOR_MATRIX_ALPHA_BIAS float 0 (-)
?GL_POST_CONVOLUTION_RED_SCALE float 1 (-)
?GL_POST_CONVOLUTION_GREEN_SCALE float 1 (-)
?GL_POST_CONVOLUTION_BLUE_SCALE float 1 (-)
?GL_POST_CONVOLUTION_ALPHA_SCALE float 1 (-)
?GL_POST_CONVOLUTION_RED_BIAS float 0 (-)
?GL_POST_CONVOLUTION_GREEN_BIAS float 0 (-)
?GL_POST_CONVOLUTION_BLUE_BIAS float 0 (-)
?GL_POST_CONVOLUTION_ALPHA_BIAS float 0 (-)
gl:pixelTransferf can be used to set any pixel transfer parameter. If the parameter type is boolean, 0 implies false and any other value implies true. If Pname is an integer parameter, Param is rounded to the nearest integer.
Likewise, gl:pixelTransferi can be used to set any of the pixel transfer parameters. Boolean parameters are set to false if Param is 0 and to true otherwise. Param is converted to floating point before being assigned to real-valued parameters.
See external documentation.
pixelTransferi(Pname, Param) -> ok
See pixelTransferf/2
pixelMapfv(Map, Mapsize, Values) -> ok
Set up pixel transfer maps
gl:pixelMap sets up translation tables, or maps, used by gl:copyPixels/5 , gl:copyTexImage1D/7 , gl:copyTexImage2D/8 , gl:copyTexSubImage1D/6 , gl:copyTexSubImage2D/8 , gl:copyTexSubImage3D/9 , gl:drawPixels/5 , gl:readPixels/7 , gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , and gl:texSubImage1D/7 . Additionally, if the ARB_imaging subset is supported, the routines gl:colorTable/6 , gl:colorSubTable/6 , gl:convolutionFilter1D/6 , gl:convolutionFilter2D/7 , gl:histogram/4 , gl:minmax/3 , and gl:separableFilter2D/8 . Use of these maps is described completely in the gl:pixelTransferf/2 reference page, and partly in the reference pages for the pixel and texture image commands. Only the specification of the maps is described in this reference page.
Map is a symbolic map name, indicating one of ten maps to set. Mapsize specifies the number of entries in the map, and Values is a pointer to an array of Mapsize map values.
If a non-zero named buffer object is bound to the ?GL_PIXEL_UNPACK_BUFFER target (see gl:bindBuffer/2 ) while a pixel transfer map is specified, Values is treated as a byte offset into the buffer object's data store.
The ten maps are as follows:
?GL_PIXEL_MAP_I_TO_I: Maps color indices to color indices.
?GL_PIXEL_MAP_S_TO_S: Maps stencil indices to stencil indices.
?GL_PIXEL_MAP_I_TO_R: Maps color indices to red components.
?GL_PIXEL_MAP_I_TO_G: Maps color indices to green components.
?GL_PIXEL_MAP_I_TO_B: Maps color indices to blue components.
?GL_PIXEL_MAP_I_TO_A: Maps color indices to alpha components.
?GL_PIXEL_MAP_R_TO_R: Maps red components to red components.
?GL_PIXEL_MAP_G_TO_G: Maps green components to green components.
?GL_PIXEL_MAP_B_TO_B: Maps blue components to blue components.
?GL_PIXEL_MAP_A_TO_A: Maps alpha components to alpha components.
The entries in a map can be specified as single-precision floating-point numbers, unsigned short integers, or unsigned int integers. Maps that store color component values (all but ?GL_PIXEL_MAP_I_TO_I and ?GL_PIXEL_MAP_S_TO_S) retain their values in floating-point format, with unspecified mantissa and exponent sizes. Floating-point values specified by gl:pixelMapfv are converted directly to the internal floating-point format of these maps, then clamped to the range [0,1]. Unsigned integer values specified by gl:pixelMapusv and gl:pixelMapuiv are converted linearly such that the largest representable integer maps to 1.0, and 0 maps to 0.0.
Maps that store indices, ?GL_PIXEL_MAP_I_TO_I and ?GL_PIXEL_MAP_S_TO_S, retain their values in fixed-point format, with an unspecified number of bits to the right of the binary point. Floating-point values specified by gl:pixelMapfv are converted directly to the internal fixed-point format of these maps. Unsigned integer values specified by gl:pixelMapusv and gl:pixelMapuiv specify integer values, with all 0's to the right of the binary point.
The following table shows the initial sizes and values for each of the maps. Maps that are indexed by either color or stencil indices must have Mapsize = 2 n for some n or the results are undefined. The maximum allowable size for each map depends on the implementation and can be determined by calling gl:getBooleanv/1 with argument ?GL_MAX_PIXEL_MAP_TABLE . The single maximum applies to all maps; it is at least 32.
Map Lookup IndexLookup ValueInitial Size Initial Value?GL_PIXEL_MAP_I_TO_I color index color index 1 0
?GL_PIXEL_MAP_S_TO_S stencil index stencil index 1 0
?GL_PIXEL_MAP_I_TO_R color index R 1 0
?GL_PIXEL_MAP_I_TO_G color index G 1 0
?GL_PIXEL_MAP_I_TO_B color index B 1 0
?GL_PIXEL_MAP_I_TO_A color index A 1 0
?GL_PIXEL_MAP_R_TO_R R R 1 0
?GL_PIXEL_MAP_G_TO_G G G 1 0
?GL_PIXEL_MAP_B_TO_B B B 1 0
?GL_PIXEL_MAP_A_TO_A A A 1 0
See external documentation.
pixelMapuiv(Map, Mapsize, Values) -> ok
See pixelMapfv/3
pixelMapusv(Map, Mapsize, Values) -> ok
See pixelMapfv/3
getPixelMapfv(Map, Values) -> ok
Return the specified pixel map
See the gl:pixelMapfv/3 reference page for a description of the acceptable values for the Map parameter. gl:getPixelMap returns in Data the contents of the pixel map specified in Map . Pixel maps are used during the execution of gl:readPixels/7 , gl:drawPixels/5 , gl:copyPixels/5 , gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , gl:texSubImage1D/7 , gl:copyTexImage1D/7 , gl:copyTexImage2D/8 , gl:copyTexSubImage1D/6 , gl:copyTexSubImage2D/8 , and gl:copyTexSubImage3D/9 . to map color indices, stencil indices, color components, and depth components to other values.
If a non-zero named buffer object is bound to the ?GL_PIXEL_PACK_BUFFER target (see gl:bindBuffer/2 ) while a pixel map is requested, Data is treated as a byte offset into the buffer object's data store.
Unsigned integer values, if requested, are linearly mapped from the internal fixed or floating-point representation such that 1.0 maps to the largest representable integer value, and 0.0 maps to 0. Return unsigned integer values are undefined if the map value was not in the range [0,1].
To determine the required size of Map , call gl:getBooleanv/1 with the appropriate symbolic constant.
See external documentation.
getPixelMapuiv(Map, Values) -> ok
See getPixelMapfv/2
getPixelMapusv(Map, Values) -> ok
See getPixelMapfv/2
bitmap(Width, Height, Xorig, Yorig, Xmove, Ymove, Bitmap) -> ok
Types
Draw a bitmap
A bitmap is a binary image. When drawn, the bitmap is positioned relative to the current raster position, and frame buffer pixels corresponding to 1's in the bitmap are written using the current raster color or index. Frame buffer pixels corresponding to 0's in the bitmap are not modified.
gl:bitmap takes seven arguments. The first pair specifies the width and height of the bitmap image. The second pair specifies the location of the bitmap origin relative to the lower left corner of the bitmap image. The third pair of arguments specifies x and y offsets to be added to the current raster position after the bitmap has been drawn. The final argument is a pointer to the bitmap image itself.
If a non-zero named buffer object is bound to the ?GL_PIXEL_UNPACK_BUFFER target (see gl:bindBuffer/2 ) while a bitmap image is specified, Bitmap is treated as a byte offset into the buffer object's data store.
The bitmap image is interpreted like image data for the gl:drawPixels/5 command, with Width and Height corresponding to the width and height arguments of that command, and with type set to ?GL_BITMAP and format set to ?GL_COLOR_INDEX . Modes specified using gl:pixelStoref/2 affect the interpretation of bitmap image data; modes specified using gl:pixelTransferf/2 do not.
If the current raster position is invalid, gl:bitmap is ignored. Otherwise, the lower left corner of the bitmap image is positioned at the window coordinates
x w=|x r-x o|
y w=|y r-y o|
where (x r y r) is the raster position and (x o y o) is the bitmap origin. Fragments are then generated for each pixel corresponding to a 1 (one) in the bitmap image. These fragments are generated using the current raster z coordinate, color or color index, and current raster texture coordinates. They are then treated just as if they had been generated by a point, line, or polygon, including texture mapping, fogging, and all per-fragment operations such as alpha and depth testing.
After the bitmap has been drawn, the x and y coordinates of the current raster position are offset by Xmove and Ymove . No change is made to the z coordinate of the current raster position, or to the current raster color, texture coordinates, or index.
See external documentation.
readPixels(X, Y, Width, Height, Format, Type, Pixels) -> ok
Types
Read a block of pixels from the frame buffer
gl:readPixels returns pixel data from the frame buffer, starting with the pixel whose lower left corner is at location ( X , Y ), into client memory starting at location Data . Several parameters control the processing of the pixel data before it is placed into client memory. These parameters are set with gl:pixelStoref/2 . This reference page describes the effects on gl:readPixels of most, but not all of the parameters specified by these three commands.
If a non-zero named buffer object is bound to the ?GL_PIXEL_PACK_BUFFER target (see gl:bindBuffer/2 ) while a block of pixels is requested, Data is treated as a byte offset into the buffer object's data store rather than a pointer to client memory.
gl:readPixels returns values from each pixel with lower left corner at (x+i y+j) for 0<= i< width and 0<= j< height. This pixel is said to be the ith pixel in the jth row. Pixels are returned in row order from the lowest to the highest row, left to right in each row.
Format specifies the format for the returned pixel values; accepted values are:
?GL_STENCIL_INDEX: Stencil values are read from the stencil buffer. Each index is converted to fixed point, shifted left or right depending on the value and sign of ?GL_INDEX_SHIFT , and added to ?GL_INDEX_OFFSET. If ?GL_MAP_STENCIL is ?GL_TRUE, indices are replaced by their mappings in the table ?GL_PIXEL_MAP_S_TO_S.
?GL_DEPTH_COMPONENT: Depth values are read from the depth buffer. Each component is converted to floating point such that the minimum depth value maps to 0 and the maximum value maps to 1. Each component is then multiplied by ?GL_DEPTH_SCALE, added to ?GL_DEPTH_BIAS , and finally clamped to the range [0 1].
?GL_DEPTH_STENCIL: Values are taken from both the depth and stencil buffers. The Type parameter must be ?GL_UNSIGNED_INT_24_8 or ?GL_FLOAT_32_UNSIGNED_INT_24_8_REV .
?GL_RED
?GL_GREEN
?GL_BLUE
?GL_RGB
?GL_BGR
?GL_RGBA
?GL_BGRA: Finally, the indices or components are converted to the proper format, as specified by Type . If Format is ?GL_STENCIL_INDEX and Type is not ?GL_FLOAT, each index is masked with the mask value given in the following table. If Type is ?GL_FLOAT, then each integer index is converted to single-precision floating-point format.
If Format is ?GL_RED, ?GL_GREEN, ?GL_BLUE, ?GL_RGB, ?GL_BGR , ?GL_RGBA, or ?GL_BGRA and Type is not ?GL_FLOAT, each component is multiplied by the multiplier shown in the following table. If type is ?GL_FLOAT, then each component is passed as is (or converted to the client's single-precision floating-point format if it is different from the one used by the GL).
Type Index MaskComponent Conversion?GL_UNSIGNED_BYTE 2 8-1(2 8-1) c
?GL_BYTE 2 7-1((2 8-1) c-1)/2
?GL_UNSIGNED_SHORT 2 16-1(2 16-1) c
?GL_SHORT 2 15-1((2 16-1) c-1)/2
?GL_UNSIGNED_INT 2 32-1(2 32-1) c
?GL_INT 2 31-1((2 32-1) c-1)/2
?GL_HALF_FLOAT none c
?GL_FLOAT none c
?GL_UNSIGNED_BYTE_3_3_2 2 N-1(2 N-1) c
?GL_UNSIGNED_BYTE_2_3_3_REV 2 N-1(2 N-1) c
?GL_UNSIGNED_SHORT_5_6_5 2 N-1 (2 N-1) c
?GL_UNSIGNED_SHORT_5_6_5_REV 2 N-1(2 N-1) c
?GL_UNSIGNED_SHORT_4_4_4_4 2 N-1(2 N-1) c
?GL_UNSIGNED_SHORT_4_4_4_4_REV 2 N-1(2 N-1) c
?GL_UNSIGNED_SHORT_5_5_5_1 2 N-1(2 N-1) c
?GL_UNSIGNED_SHORT_1_5_5_5_REV 2 N-1 (2 N-1) c
?GL_UNSIGNED_INT_8_8_8_8 2 N-1(2 N-1) c
?GL_UNSIGNED_INT_8_8_8_8_REV 2 N-1(2 N-1) c
?GL_UNSIGNED_INT_10_10_10_2 2 N-1(2 N-1) c
?GL_UNSIGNED_INT_2_10_10_10_REV 2 N-1(2 N-1) c
?GL_UNSIGNED_INT_24_8 2 N-1(2 N-1) c
?GL_UNSIGNED_INT_10F_11F_11F_REV -- Special
?GL_UNSIGNED_INT_5_9_9_9_REV -- Special
?GL_FLOAT_32_UNSIGNED_INT_24_8_REV none c (Depth Only)
Return values are placed in memory as follows. If Format is ?GL_STENCIL_INDEX , ?GL_DEPTH_COMPONENT, ?GL_RED, ?GL_GREEN, or ?GL_BLUE, a single value is returned and the data for the ith pixel in the jth row is placed in location (j) width+i. ?GL_RGB and ?GL_BGR return three values, ?GL_RGBA and ?GL_BGRA return four values for each pixel, with all values corresponding to a single pixel occupying contiguous space in Data . Storage parameters set by gl:pixelStoref/2 , such as ?GL_PACK_LSB_FIRST and ?GL_PACK_SWAP_BYTES, affect the way that data is written into memory. See gl:pixelStoref/2 for a description.
See external documentation.
drawPixels(Width, Height, Format, Type, Pixels) -> ok
Write a block of pixels to the frame buffer
gl:drawPixels reads pixel data from memory and writes it into the frame buffer relative to the current raster position, provided that the raster position is valid. Use gl:rasterPos2d/2 or gl:windowPos2d/2 to set the current raster position; use gl:getBooleanv/1 with argument ?GL_CURRENT_RASTER_POSITION_VALID to determine if the specified raster position is valid, and gl:getBooleanv/1 with argument ?GL_CURRENT_RASTER_POSITION to query the raster position.
Several parameters define the encoding of pixel data in memory and control the processing of the pixel data before it is placed in the frame buffer. These parameters are set with four commands: gl:pixelStoref/2 , gl:pixelTransferf/2 , gl:pixelMapfv/3 , and gl:pixelZoom/2 . This reference page describes the effects on gl:drawPixels of many, but not all, of the parameters specified by these four commands.
Data is read from Data as a sequence of signed or unsigned bytes, signed or unsigned shorts, signed or unsigned integers, or single-precision floating-point values, depending on Type . When Type is one of ?GL_UNSIGNED_BYTE, ?GL_BYTE, ?GL_UNSIGNED_SHORT , ?GL_SHORT, ?GL_UNSIGNED_INT, ?GL_INT, or ?GL_FLOAT each of these bytes, shorts, integers, or floating-point values is interpreted as one color or depth component, or one index, depending on Format . When Type is one of ?GL_UNSIGNED_BYTE_3_3_2 , ?GL_UNSIGNED_SHORT_5_6_5, ?GL_UNSIGNED_SHORT_4_4_4_4, ?GL_UNSIGNED_SHORT_5_5_5_1 , ?GL_UNSIGNED_INT_8_8_8_8, or ?GL_UNSIGNED_INT_10_10_10_2, each unsigned value is interpreted as containing all the components for a single pixel, with the color components arranged according to Format . When Type is one of ?GL_UNSIGNED_BYTE_2_3_3_REV , ?GL_UNSIGNED_SHORT_5_6_5_REV, ?GL_UNSIGNED_SHORT_4_4_4_4_REV, ?GL_UNSIGNED_SHORT_1_5_5_5_REV , ?GL_UNSIGNED_INT_8_8_8_8_REV, or ?GL_UNSIGNED_INT_2_10_10_10_REV, each unsigned value is interpreted as containing all color components, specified by Format , for a single pixel in a reversed order. Indices are always treated individually. Color components are treated as groups of one, two, three, or four values, again based on Format . Both individual indices and groups of components are referred to as pixels. If Type is ?GL_BITMAP, the data must be unsigned bytes, and Format must be either ?GL_COLOR_INDEX or ?GL_STENCIL_INDEX. Each unsigned byte is treated as eight 1-bit pixels, with bit ordering determined by ?GL_UNPACK_LSB_FIRST (see gl:pixelStoref/2 ).
width×height pixels are read from memory, starting at location Data . By default, these pixels are taken from adjacent memory locations, except that after all Width pixels are read, the read pointer is advanced to the next four-byte boundary. The four-byte row alignment is specified by gl:pixelStoref/2 with argument ?GL_UNPACK_ALIGNMENT , and it can be set to one, two, four, or eight bytes. Other pixel store parameters specify different read pointer advancements, both before the first pixel is read and after all Width pixels are read. See the gl:pixelStoref/2 reference page for details on these options.
If a non-zero named buffer object is bound to the ?GL_PIXEL_UNPACK_BUFFER target (see gl:bindBuffer/2 ) while a block of pixels is specified, Data is treated as a byte offset into the buffer object's data store.
The width×height pixels that are read from memory are each operated on in the same way, based on the values of several parameters specified by gl:pixelTransferf/2 and gl:pixelMapfv/3 . The details of these operations, as well as the target buffer into which the pixels are drawn, are specific to the format of the pixels, as specified by Format . Format can assume one of 13 symbolic values:
?GL_COLOR_INDEX: Each pixel is a single value, a color index. It is converted to fixed-point format, with an unspecified number of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0. Bitmap data convert to either 0 or 1.
Each fixed-point index is then shifted left by ?GL_INDEX_SHIFT bits and added to ?GL_INDEX_OFFSET . If ?GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result.
If the GL is in RGBA mode, the resulting index is converted to an RGBA pixel with the help of the ?GL_PIXEL_MAP_I_TO_R, ?GL_PIXEL_MAP_I_TO_G, ?GL_PIXEL_MAP_I_TO_B , and ?GL_PIXEL_MAP_I_TO_A tables. If the GL is in color index mode, and if ?GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table ?GL_PIXEL_MAP_I_TO_I . Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 b-1, where b is the number of bits in a color index buffer.
The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that x n=x r+n% width
y n=y r+|n/width|
where (x r y r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
?GL_STENCIL_INDEX: Each pixel is a single value, a stencil index. It is converted to fixed-point format, with an unspecified number of bits to the right of the binary point, regardless of the memory data type. Floating-point values convert to true fixed-point values. Signed and unsigned integer data is converted with all fraction bits set to 0. Bitmap data convert to either 0 or 1.
Each fixed-point index is then shifted left by ?GL_INDEX_SHIFT bits, and added to ?GL_INDEX_OFFSET. If ?GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If ?GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table ?GL_PIXEL_MAP_S_TO_S. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 b-1, where b is the number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the nth index is written to location
x n=x r+n% width
y n=y r+|n/width|
where (x r y r) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil writemask affect these write operations.
?GL_DEPTH_COMPONENT: Each pixel is a single-depth component. Floating-point data is converted directly to an internal floating-point format with unspecified precision. Signed integer data is mapped linearly to the internal floating-point format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to -1.0. Unsigned integer data is mapped similarly: the largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point depth value is then multiplied by ?GL_DEPTH_SCALE and added to ?GL_DEPTH_BIAS. The result is clamped to the range [0 1].
The GL then converts the resulting depth components to fragments by attaching the current raster position color or color index and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that
x n=x r+n% width
y n=y r+|n/width|
where (x r y r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
?GL_RGBA
?GL_BGRA: Each pixel is a four-component group: For ?GL_RGBA, the red component is first, followed by green, followed by blue, followed by alpha; for ?GL_BGRA the order is blue, green, red and then alpha. Floating-point values are converted directly to an internal floating-point format with unspecified precision. Signed integer values are mapped linearly to the internal floating-point format such that the most positive representable integer value maps to 1.0, and the most negative representable value maps to -1.0. (Note that this mapping does not convert 0 precisely to 0.0.) Unsigned integer data is mapped similarly: The largest integer value maps to 1.0, and 0 maps to 0.0. The resulting floating-point color values are then multiplied by ?GL_c_SCALE and added to ?GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0 1].
If ?GL_MAP_COLOR is true, each color component is scaled by the size of lookup table ?GL_PIXEL_MAP_c_TO_c, then replaced by the value that it references in that table. c is R, G, B, or A respectively.
The GL then converts the resulting RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning x and y window coordinates to the nth fragment such that
x n=x r+n% width
y n=y r+|n/width|
where (x r y r) is the current raster position. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
?GL_RED: Each pixel is a single red component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with green and blue set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
?GL_GREEN: Each pixel is a single green component. This component is converted to the internal floating-point format in the same way the green component of an RGBA pixel is. It is then converted to an RGBA pixel with red and blue set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
?GL_BLUE: Each pixel is a single blue component. This component is converted to the internal floating-point format in the same way the blue component of an RGBA pixel is. It is then converted to an RGBA pixel with red and green set to 0, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
?GL_ALPHA: Each pixel is a single alpha component. This component is converted to the internal floating-point format in the same way the alpha component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green, and blue set to 0. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
?GL_RGB
?GL_BGR: Each pixel is a three-component group: red first, followed by green, followed by blue; for ?GL_BGR, the first component is blue, followed by green and then red. Each component is converted to the internal floating-point format in the same way the red, green, and blue components of an RGBA pixel are. The color triple is converted to an RGBA pixel with alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
?GL_LUMINANCE: Each pixel is a single luminance component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is. It is then converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to 1. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
?GL_LUMINANCE_ALPHA: Each pixel is a two-component group: luminance first, followed by alpha. The two components are converted to the internal floating-point format in the same way the red component of an RGBA pixel is. They are then converted to an RGBA pixel with red, green, and blue set to the converted luminance value, and alpha set to the converted alpha value. After this conversion, the pixel is treated as if it had been read as an RGBA pixel.
The following table summarizes the meaning of the valid constants for the type parameter:
TypeCorresponding Type?GL_UNSIGNED_BYTE unsigned 8-bit integer
?GL_BYTE signed 8-bit integer
?GL_BITMAP single bits in unsigned 8-bit integers
?GL_UNSIGNED_SHORT unsigned 16-bit integer
?GL_SHORT signed 16-bit integer
?GL_UNSIGNED_INT unsigned 32-bit integer
?GL_INT 32-bit integer
?GL_FLOAT single-precision floating-point
?GL_UNSIGNED_BYTE_3_3_2 unsigned 8-bit integer
?GL_UNSIGNED_BYTE_2_3_3_REV unsigned 8-bit integer with reversed component ordering
?GL_UNSIGNED_SHORT_5_6_5 unsigned 16-bit integer
?GL_UNSIGNED_SHORT_5_6_5_REV unsigned 16-bit integer with reversed component ordering
?GL_UNSIGNED_SHORT_4_4_4_4 unsigned 16-bit integer
?GL_UNSIGNED_SHORT_4_4_4_4_REV unsigned 16-bit integer with reversed component ordering
?GL_UNSIGNED_SHORT_5_5_5_1 unsigned 16-bit integer
?GL_UNSIGNED_SHORT_1_5_5_5_REV unsigned 16-bit integer with reversed component ordering
?GL_UNSIGNED_INT_8_8_8_8 unsigned 32-bit integer
?GL_UNSIGNED_INT_8_8_8_8_REV unsigned 32-bit integer with reversed component ordering
?GL_UNSIGNED_INT_10_10_10_2 unsigned 32-bit integer
?GL_UNSIGNED_INT_2_10_10_10_REV unsigned 32-bit integer with reversed component ordering
The rasterization described so far assumes pixel zoom factors of 1. If gl:pixelZoom/2 is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x r y r) is the current raster position, and a given pixel is in the nth column and mth row of the pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at
(x r+(zoom x) n y r+(zoom y) m)
(x r+(zoom x)(n+1) y r+(zoom y)(m+1))
where zoom x is the value of ?GL_ZOOM_X and zoom y is the value of ?GL_ZOOM_Y .
See external documentation.
copyPixels(X, Y, Width, Height, Type) -> ok
Copy pixels in the frame buffer
gl:copyPixels copies a screen-aligned rectangle of pixels from the specified frame buffer location to a region relative to the current raster position. Its operation is well defined only if the entire pixel source region is within the exposed portion of the window. Results of copies from outside the window, or from regions of the window that are not exposed, are hardware dependent and undefined.
X and Y specify the window coordinates of the lower left corner of the rectangular region to be copied. Width and Height specify the dimensions of the rectangular region to be copied. Both Width and Height must not be negative.
Several parameters control the processing of the pixel data while it is being copied. These parameters are set with three commands: gl:pixelTransferf/2 , gl:pixelMapfv/3 , and gl:pixelZoom/2 . This reference page describes the effects on gl:copyPixels of most, but not all, of the parameters specified by these three commands.
gl:copyPixels copies values from each pixel with the lower left-hand corner at (x+i y+j) for 0<= i< width and 0<= j< height. This pixel is said to be the ith pixel in the jth row. Pixels are copied in row order from the lowest to the highest row, left to right in each row.
Type specifies whether color, depth, or stencil data is to be copied. The details of the transfer for each data type are as follows:
?GL_COLOR: Indices or RGBA colors are read from the buffer currently specified as the read source buffer (see gl:readBuffer/1 ). If the GL is in color index mode, each index that is read from this buffer is converted to a fixed-point format with an unspecified number of bits to the right of the binary point. Each index is then shifted left by ?GL_INDEX_SHIFT bits, and added to ?GL_INDEX_OFFSET. If ?GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If ?GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table ?GL_PIXEL_MAP_I_TO_I. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 b-1, where b is the number of bits in a color index buffer.
If the GL is in RGBA mode, the red, green, blue, and alpha components of each pixel that is read are converted to an internal floating-point format with unspecified precision. The conversion maps the largest representable component value to 1.0, and component value 0 to 0.0. The resulting floating-point color values are then multiplied by ?GL_c_SCALE and added to ?GL_c_BIAS, where c is RED, GREEN, BLUE, and ALPHA for the respective color components. The results are clamped to the range [0,1]. If ?GL_MAP_COLOR is true, each color component is scaled by the size of lookup table ?GL_PIXEL_MAP_c_TO_c , then replaced by the value that it references in that table. c is R, G, B, or A.
If the ARB_imaging extension is supported, the color values may be additionally processed by color-table lookups, color-matrix transformations, and convolution filters.
The GL then converts the resulting indices or RGBA colors to fragments by attaching the current raster position z coordinate and texture coordinates to each pixel, then assigning window coordinates (x r+i y r+j), where (x r y r) is the current raster position, and the pixel was the ith pixel in the jth row. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
?GL_DEPTH: Depth values are read from the depth buffer and converted directly to an internal floating-point format with unspecified precision. The resulting floating-point depth value is then multiplied by ?GL_DEPTH_SCALE and added to ?GL_DEPTH_BIAS . The result is clamped to the range [0,1].
The GL then converts the resulting depth components to fragments by attaching the current raster position color or color index and texture coordinates to each pixel, then assigning window coordinates (x r+i y r+j), where (x r y r) is the current raster position, and the pixel was the ith pixel in the jth row. These pixel fragments are then treated just like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer.
?GL_STENCIL: Stencil indices are read from the stencil buffer and converted to an internal fixed-point format with an unspecified number of bits to the right of the binary point. Each fixed-point index is then shifted left by ?GL_INDEX_SHIFT bits, and added to ?GL_INDEX_OFFSET. If ?GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If ?GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table ?GL_PIXEL_MAP_S_TO_S. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 b-1, where b is the number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the index read from the ith location of the jth row is written to location (x r+i y r+j), where (x r y r) is the current raster position. Only the pixel ownership test, the scissor test, and the stencil writemask affect these write operations.
The rasterization described thus far assumes pixel zoom factors of 1.0. If gl:pixelZoom/2 is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x r y r) is the current raster position, and a given pixel is in the ith location in the jth row of the source pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at
(x r+(zoom x) i y r+(zoom y) j)
and
(x r+(zoom x)(i+1) y r+(zoom y)(j+1))
where zoom x is the value of ?GL_ZOOM_X and zoom y is the value of ?GL_ZOOM_Y .
See external documentation.
stencilFunc(Func, Ref, Mask) -> ok
Set front and back function and reference value for stencil testing
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. Stencil planes are first drawn into using GL drawing primitives, then geometry and images are rendered using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.
The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the reference value and the value in the stencil buffer. To enable and disable the test, call gl:enable/1 and gl:enable/1 with argument ?GL_STENCIL_TEST . To specify actions based on the outcome of the stencil test, call gl:stencilOp/3 or gl:stencilOpSeparate/4 .
There can be two separate sets of Func , Ref , and Mask parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. gl:stencilFunc/3 sets both front and back stencil state to the same values. Use gl:stencilFuncSeparate/4 to set front and back stencil state to different values.
Func is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. Ref is an integer reference value that is used in the stencil comparison. It is clamped to the range [0 2 n-1], where n is the number of bitplanes in the stencil buffer. Mask is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison.
If stencil represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by Func . Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see gl:stencilOp/3 ). All tests treat stencil values as unsigned integers in the range [0 2 n-1], where n is the number of bitplanes in the stencil buffer.
The following values are accepted by Func :
?GL_NEVER: Always fails.
?GL_LESS: Passes if ( Ref & Mask ) < ( stencil & Mask ).
?GL_LEQUAL: Passes if ( Ref & Mask ) <= ( stencil & Mask ).
?GL_GREATER: Passes if ( Ref & Mask ) > ( stencil & Mask ).
?GL_GEQUAL: Passes if ( Ref & Mask ) >= ( stencil & Mask ).
?GL_EQUAL: Passes if ( Ref & Mask ) = ( stencil & Mask ).
?GL_NOTEQUAL: Passes if ( Ref & Mask ) != ( stencil & Mask ).
?GL_ALWAYS: Always passes.
See external documentation.
Types
Control the front and back writing of individual bits in the stencil planes
gl:stencilMask controls the writing of individual bits in the stencil planes. The least significant n bits of Mask , where n is the number of bits in the stencil buffer, specify a mask. Where a 1 appears in the mask, it's possible to write to the corresponding bit in the stencil buffer. Where a 0 appears, the corresponding bit is write-protected. Initially, all bits are enabled for writing.
There can be two separate Mask writemasks; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. gl:stencilMask/1 sets both front and back stencil writemasks to the same values. Use gl:stencilMaskSeparate/2 to set front and back stencil writemasks to different values.
See external documentation.
stencilOp(Fail, Zfail, Zpass) -> ok
Set front and back stencil test actions
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.
The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the value in the stencil buffer and a reference value. To enable and disable the test, call gl:enable/1 and gl:enable/1 with argument ?GL_STENCIL_TEST ; to control it, call gl:stencilFunc/3 or gl:stencilFuncSeparate/4 .
There can be two separate sets of Sfail , Dpfail , and Dppass parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. gl:stencilOp/3 sets both front and back stencil state to the same values. Use gl:stencilOpSeparate/4 to set front and back stencil state to different values.
gl:stencilOp takes three arguments that indicate what happens to the stored stencil value while stenciling is enabled. If the stencil test fails, no change is made to the pixel's color or depth buffers, and Sfail specifies what happens to the stencil buffer contents. The following eight actions are possible.
?GL_KEEP: Keeps the current value.
?GL_ZERO: Sets the stencil buffer value to 0.
?GL_REPLACE: Sets the stencil buffer value to ref, as specified by gl:stencilFunc/3 .
?GL_INCR: Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.
?GL_INCR_WRAP: Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value.
?GL_DECR: Decrements the current stencil buffer value. Clamps to 0.
?GL_DECR_WRAP: Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero.
?GL_INVERT: Bitwise inverts the current stencil buffer value.
Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and 2 n-1, where n is the value returned by querying ?GL_STENCIL_BITS .
The other two arguments to gl:stencilOp specify stencil buffer actions that depend on whether subsequent depth buffer tests succeed ( Dppass ) or fail ( Dpfail ) (see gl:depthFunc/1 ). The actions are specified using the same eight symbolic constants as Sfail . Note that Dpfail is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, Sfail and Dppass specify stencil action when the stencil test fails and passes, respectively.
See external documentation.
Types
Specify the clear value for the stencil buffer
gl:clearStencil specifies the index used by gl:clear/1 to clear the stencil buffer. S is masked with 2 m-1, where m is the number of bits in the stencil buffer.
See external documentation.
texGend(Coord, Pname, Param) -> ok
Control the generation of texture coordinates
gl:texGen selects a texture-coordinate generation function or supplies coefficients for one of the functions. Coord names one of the (s, t, r, q ) texture coordinates; it must be one of the symbols ?GL_S, ?GL_T, ?GL_R , or ?GL_Q. Pname must be one of three symbolic constants: ?GL_TEXTURE_GEN_MODE , ?GL_OBJECT_PLANE, or ?GL_EYE_PLANE. If Pname is ?GL_TEXTURE_GEN_MODE , then Params chooses a mode, one of ?GL_OBJECT_LINEAR, ?GL_EYE_LINEAR , ?GL_SPHERE_MAP, ?GL_NORMAL_MAP, or ?GL_REFLECTION_MAP. If Pname is either ?GL_OBJECT_PLANE or ?GL_EYE_PLANE, Params contains coefficients for the corresponding texture generation function.
If the texture generation function is ?GL_OBJECT_LINEAR, the function
g=p 1×x o+p 2×y o+p 3×z o+p 4×w o
is used, where g is the value computed for the coordinate named in Coord , p 1, p 2, p 3, and p 4 are the four values supplied in Params , and x o, y o, z o, and w o are the object coordinates of the vertex. This function can be used, for example, to texture-map terrain using sea level as a reference plane (defined by p 1, p 2, p 3, and p 4). The altitude of a terrain vertex is computed by the ?GL_OBJECT_LINEAR coordinate generation function as its distance from sea level; that altitude can then be used to index the texture image to map white snow onto peaks and green grass onto foothills.
If the texture generation function is ?GL_EYE_LINEAR, the function
g=(p 1)"×x e+(p 2)"×y e+(p 3)"×z e+(p 4)"×w e
is used, where
((p 1)" (p 2)" (p 3)" (p 4)")=(p 1 p 2 p 3 p 4) M -1
and x e, y e, z e, and w e are the eye coordinates of the vertex, p 1, p 2, p 3, and p 4 are the values supplied in Params , and M is the modelview matrix when gl:texGen is invoked. If M is poorly conditioned or singular, texture coordinates generated by the resulting function may be inaccurate or undefined.
Note that the values in Params define a reference plane in eye coordinates. The modelview matrix that is applied to them may not be the same one in effect when the polygon vertices are transformed. This function establishes a field of texture coordinates that can produce dynamic contour lines on moving objects.
If the texture generation function is ?GL_SPHERE_MAP and Coord is either ?GL_S or ?GL_T, s and t texture coordinates are generated as follows. Let u be the unit vector pointing from the origin to the polygon vertex (in eye coordinates). Let n sup prime be the current normal, after transformation to eye coordinates.  Then the values assigned to the s and t texture coordinates are
s=f x/m+1/2
t=f y/m+1/2
To enable or disable a texture-coordinate generation function, call gl:enable/1 or gl:enable/1 with one of the symbolic texture-coordinate names (?GL_TEXTURE_GEN_S , ?GL_TEXTURE_GEN_T, ?GL_TEXTURE_GEN_R, or ?GL_TEXTURE_GEN_Q) as the argument. When enabled, the specified texture coordinate is computed according to the generating function associated with that coordinate. When disabled, subsequent vertices take the specified texture coordinate from the current set of texture coordinates. Initially, all texture generation functions are set to ?GL_EYE_LINEAR and are disabled. Both s plane equations are (1, 0, 0, 0), both t plane equations are (0, 1, 0, 0), and all r and q plane equations are (0, 0, 0, 0).
When the ARB_multitexture extension is supported, gl:texGen sets the texture generation parameters for the currently active texture unit, selected with gl:activeTexture/1 .
See external documentation.
texGenf(Coord, Pname, Param) -> ok
See texGend/3
texGeni(Coord, Pname, Param) -> ok
See texGend/3
texGendv(Coord, Pname, Params) -> ok
See texGend/3
texGenfv(Coord, Pname, Params) -> ok
See texGend/3
texGeniv(Coord, Pname, Params) -> ok
See texGend/3
getTexGendv(Coord, Pname) -> {float(), float(), float(), float()}
Return texture coordinate generation parameters
gl:getTexGen returns in Params selected parameters of a texture coordinate generation function that was specified using gl:texGend/3 . Coord names one of the (s, t, r, q) texture coordinates, using the symbolic constant ?GL_S, ?GL_T, ?GL_R, or ?GL_Q.
Pname specifies one of three symbolic names:
?GL_TEXTURE_GEN_MODE: Params returns the single-valued texture generation function, a symbolic constant. The initial value is ?GL_EYE_LINEAR.
?GL_OBJECT_PLANE: Params returns the four plane equation coefficients that specify object linear-coordinate generation. Integer values, when requested, are mapped directly from the internal floating-point representation.
?GL_EYE_PLANE: Params returns the four plane equation coefficients that specify eye linear-coordinate generation. Integer values, when requested, are mapped directly from the internal floating-point representation. The returned values are those maintained in eye coordinates. They are not equal to the values specified using gl:texGend/3 , unless the modelview matrix was identity when gl:texGend/3 was called.
See external documentation.
getTexGenfv(Coord, Pname) -> {float(), float(), float(), float()}
See getTexGendv/2
getTexGeniv(Coord, Pname) -> {integer(), integer(), integer(), integer()}
See getTexGendv/2
texEnvf(Target, Pname, Param) -> ok
texEnvi(Target, Pname, Param) -> ok
texEnvfv(Target, Pname, Params) -> ok
Set texture environment parameters
A texture environment specifies how texture values are interpreted when a fragment is textured. When Target is ?GL_TEXTURE_FILTER_CONTROL, Pname must be ?GL_TEXTURE_LOD_BIAS . When Target is ?GL_TEXTURE_ENV, Pname can be ?GL_TEXTURE_ENV_MODE , ?GL_TEXTURE_ENV_COLOR, ?GL_COMBINE_RGB, ?GL_COMBINE_ALPHA, ?GL_RGB_SCALE , ?GL_ALPHA_SCALE, ?GL_SRC0_RGB, ?GL_SRC1_RGB, ?GL_SRC2_RGB, ?GL_SRC0_ALPHA , ?GL_SRC1_ALPHA, or ?GL_SRC2_ALPHA.
If Pname is ?GL_TEXTURE_ENV_MODE, then Params is (or points to) the symbolic name of a texture function. Six texture functions may be specified: ?GL_ADD , ?GL_MODULATE, ?GL_DECAL, ?GL_BLEND, ?GL_REPLACE, or ?GL_COMBINE .
The following table shows the correspondence of filtered texture values R t, G t, B t, A t, L t, I t to texture source components. C s and A s are used by the texture functions described below.
Texture Base Internal Format C s A s?GL_ALPHA (0, 0, 0) A t
?GL_LUMINANCE ( L t, L t, L t ) 1
?GL_LUMINANCE_ALPHA ( L t, L t, L t ) A t
?GL_INTENSITY ( I t, I t, I t ) I t
?GL_RGB ( R t, G t, B t ) 1
?GL_RGBA ( R t, G t, B t ) A t
A texture function acts on the fragment to be textured using the texture image value that applies to the fragment (see gl:texParameterf/3 ) and produces an RGBA color for that fragment. The following table shows how the RGBA color is produced for each of the first five texture functions that can be chosen. C is a triple of color values (RGB) and A is the associated alpha value. RGBA values extracted from a texture image are in the range [0,1]. The subscript p refers to the color computed from the previous texture stage (or the incoming fragment if processing texture stage 0), the subscript s to the texture source color, the subscript c to the texture environment color, and the subscript v indicates a value produced by the texture function.

The following describes how the texture sources, as specified by ?GL_SRC0_RGB, ?GL_SRC1_RGB , ?GL_SRC2_RGB, ?GL_SRC0_ALPHA, ?GL_SRC1_ALPHA, and ?GL_SRC2_ALPHA , are combined to produce a final texture color. In the following tables, ?GL_SRC0_c is represented by Arg0, ?GL_SRC1_c is represented by Arg1, and ?GL_SRC2_c is represented by Arg2.
?GL_COMBINE_RGB accepts any of ?GL_REPLACE, ?GL_MODULATE, ?GL_ADD , ?GL_ADD_SIGNED, ?GL_INTERPOLATE, ?GL_SUBTRACT, ?GL_DOT3_RGB, or ?GL_DOT3_RGBA.
?GL_COMBINE_RGBTexture Function?GL_REPLACE Arg0
?GL_MODULATE Arg0×Arg1
?GL_ADD Arg0+Arg1
?GL_ADD_SIGNED Arg0+Arg1-0.5
?GL_INTERPOLATE Arg0×Arg2+Arg1×(1- Arg2)
?GL_SUBTRACT Arg0-Arg1
?GL_DOT3_RGB or ?GL_DOT3_RGBA 4×((((Arg0 r)-0.5)×((Arg1 r)-0.5))+(((Arg0 g)-0.5)×((Arg1 g)-0.5))+(((Arg0 b)-0.5)×((Arg1 b)-0.5)))
The scalar results for ?GL_DOT3_RGB and ?GL_DOT3_RGBA are placed into each of the 3 (RGB) or 4 (RGBA) components on output.
Likewise, ?GL_COMBINE_ALPHA accepts any of ?GL_REPLACE, ?GL_MODULATE, ?GL_ADD, ?GL_ADD_SIGNED, ?GL_INTERPOLATE, or ?GL_SUBTRACT. The following table describes how alpha values are combined:
?GL_COMBINE_ALPHATexture Function?GL_REPLACE Arg0
?GL_MODULATE Arg0×Arg1
?GL_ADD Arg0+Arg1
?GL_ADD_SIGNED Arg0+Arg1-0.5
?GL_INTERPOLATE Arg0×Arg2+Arg1×(1- Arg2)
?GL_SUBTRACT Arg0-Arg1
In the following tables, the value C s represents the color sampled from the currently bound texture, C c represents the constant texture-environment color, C f represents the primary color of the incoming fragment, and C p represents the color computed from the previous texture stage or C f if processing texture stage 0. Likewise, A s, A c, A f, and A p represent the respective alpha values.
The following table describes the values assigned to Arg0, Arg1, and Arg2 based upon the RGB sources and operands:
?GL_SRCn_RGB?GL_OPERANDn_RGBArgument Value?GL_TEXTURE?GL_SRC_COLOR(C s)
?GL_ONE_MINUS_SRC_COLOR 1-(C s)
?GL_SRC_ALPHA(A s)
?GL_ONE_MINUS_SRC_ALPHA 1-(A s)
?GL_TEXTUREn?GL_SRC_COLOR(C s)
?GL_ONE_MINUS_SRC_COLOR 1-(C s)
?GL_SRC_ALPHA (A s)
?GL_ONE_MINUS_SRC_ALPHA 1-(A s)
?GL_CONSTANT?GL_SRC_COLOR(C c)
?GL_ONE_MINUS_SRC_COLOR 1-(C c)
?GL_SRC_ALPHA(A c)
?GL_ONE_MINUS_SRC_ALPHA 1-(A c)
?GL_PRIMARY_COLOR ?GL_SRC_COLOR(C f)
?GL_ONE_MINUS_SRC_COLOR 1-(C f)
?GL_SRC_ALPHA(A f)
?GL_ONE_MINUS_SRC_ALPHA 1-(A f)
?GL_PREVIOUS?GL_SRC_COLOR (C p)
?GL_ONE_MINUS_SRC_COLOR 1-(C p)
?GL_SRC_ALPHA(A p)
?GL_ONE_MINUS_SRC_ALPHA 1-(A p)
For ?GL_TEXTUREn sources, C s and A s represent the color and alpha, respectively, produced from texture stage n.
The follow table describes the values assigned to Arg0, Arg1, and Arg2 based upon the alpha sources and operands:
?GL_SRCn_ALPHA?GL_OPERANDn_ALPHAArgument Value?GL_TEXTURE?GL_SRC_ALPHA(A s)
?GL_ONE_MINUS_SRC_ALPHA 1-(A s)
?GL_TEXTUREn ?GL_SRC_ALPHA(A s)
?GL_ONE_MINUS_SRC_ALPHA 1-(A s)
?GL_CONSTANT?GL_SRC_ALPHA(A c)
?GL_ONE_MINUS_SRC_ALPHA 1-(A c)
?GL_PRIMARY_COLOR ?GL_SRC_ALPHA(A f)
?GL_ONE_MINUS_SRC_ALPHA 1-(A f)
?GL_PREVIOUS?GL_SRC_ALPHA(A p)
?GL_ONE_MINUS_SRC_ALPHA 1-(A p)
The RGB and alpha results of the texture function are multipled by the values of ?GL_RGB_SCALE and ?GL_ALPHA_SCALE, respectively, and clamped to the range [0 1].
If Pname is ?GL_TEXTURE_ENV_COLOR, Params is a pointer to an array that holds an RGBA color consisting of four values. Integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0. The values are clamped to the range [0,1] when they are specified. C c takes these four values.
If Pname is ?GL_TEXTURE_LOD_BIAS, the value specified is added to the texture level-of-detail parameter, that selects which mipmap, or mipmaps depending upon the selected ?GL_TEXTURE_MIN_FILTER, will be sampled.
?GL_TEXTURE_ENV_MODE defaults to ?GL_MODULATE and ?GL_TEXTURE_ENV_COLOR defaults to (0, 0, 0, 0).
If Target is ?GL_POINT_SPRITE and Pname is ?GL_COORD_REPLACE, the boolean value specified is used to either enable or disable point sprite texture coordinate replacement. The default value is ?GL_FALSE.
See external documentation.
texEnviv(Target, Pname, Params) -> ok
See texEnvfv/3
getTexEnvfv(Target, Pname) -> {float(), float(), float(), float()}
Return texture environment parameters
gl:getTexEnv returns in Params selected values of a texture environment that was specified with gl:texEnvfv/3 . Target specifies a texture environment.
When Target is ?GL_TEXTURE_FILTER_CONTROL, Pname must be ?GL_TEXTURE_LOD_BIAS . When Target is ?GL_POINT_SPRITE, Pname must be ?GL_COORD_REPLACE . When Target is ?GL_TEXTURE_ENV, Pname can be ?GL_TEXTURE_ENV_MODE , ?GL_TEXTURE_ENV_COLOR, ?GL_COMBINE_RGB, ?GL_COMBINE_ALPHA, ?GL_RGB_SCALE , ?GL_ALPHA_SCALE, ?GL_SRC0_RGB, ?GL_SRC1_RGB, ?GL_SRC2_RGB, ?GL_SRC0_ALPHA, ?GL_SRC1_ALPHA, or ?GL_SRC2_ALPHA.
Pname names a specific texture environment parameter, as follows:
?GL_TEXTURE_ENV_MODE: Params returns the single-valued texture environment mode, a symbolic constant. The initial value is ?GL_MODULATE.
?GL_TEXTURE_ENV_COLOR: Params returns four integer or floating-point values that are the texture environment color. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer, and -1.0 maps to the most negative representable integer. The initial value is (0, 0, 0, 0).
?GL_TEXTURE_LOD_BIAS: Params returns a single floating-point value that is the texture level-of-detail bias. The initial value is 0.
?GL_COMBINE_RGB: Params returns a single symbolic constant value representing the current RGB combine mode. The initial value is ?GL_MODULATE.
?GL_COMBINE_ALPHA: Params returns a single symbolic constant value representing the current alpha combine mode. The initial value is ?GL_MODULATE.
?GL_SRC0_RGB: Params returns a single symbolic constant value representing the texture combiner zero's RGB source. The initial value is ?GL_TEXTURE.
?GL_SRC1_RGB: Params returns a single symbolic constant value representing the texture combiner one's RGB source. The initial value is ?GL_PREVIOUS.
?GL_SRC2_RGB: Params returns a single symbolic constant value representing the texture combiner two's RGB source. The initial value is ?GL_CONSTANT.
?GL_SRC0_ALPHA: Params returns a single symbolic constant value representing the texture combiner zero's alpha source. The initial value is ?GL_TEXTURE.
?GL_SRC1_ALPHA: Params returns a single symbolic constant value representing the texture combiner one's alpha source. The initial value is ?GL_PREVIOUS.
?GL_SRC2_ALPHA: Params returns a single symbolic constant value representing the texture combiner two's alpha source. The initial value is ?GL_CONSTANT.
?GL_OPERAND0_RGB: Params returns a single symbolic constant value representing the texture combiner zero's RGB operand. The initial value is ?GL_SRC_COLOR.
?GL_OPERAND1_RGB: Params returns a single symbolic constant value representing the texture combiner one's RGB operand. The initial value is ?GL_SRC_COLOR.
?GL_OPERAND2_RGB: Params returns a single symbolic constant value representing the texture combiner two's RGB operand. The initial value is ?GL_SRC_ALPHA.
?GL_OPERAND0_ALPHA: Params returns a single symbolic constant value representing the texture combiner zero's alpha operand. The initial value is ?GL_SRC_ALPHA.
?GL_OPERAND1_ALPHA: Params returns a single symbolic constant value representing the texture combiner one's alpha operand. The initial value is ?GL_SRC_ALPHA.
?GL_OPERAND2_ALPHA: Params returns a single symbolic constant value representing the texture combiner two's alpha operand. The initial value is ?GL_SRC_ALPHA.
?GL_RGB_SCALE: Params returns a single floating-point value representing the current RGB texture combiner scaling factor. The initial value is 1.0.
?GL_ALPHA_SCALE: Params returns a single floating-point value representing the current alpha texture combiner scaling factor. The initial value is 1.0.
?GL_COORD_REPLACE: Params returns a single boolean value representing the current point sprite texture coordinate replacement enable state. The initial value is ?GL_FALSE .
See external documentation.
getTexEnviv(Target, Pname) -> {integer(), integer(), integer(), integer()}
See getTexEnvfv/2
texParameterf(Target, Pname, Param) -> ok
Set texture parameters
gl:texParameter assigns the value or values in Params to the texture parameter specified as Pname . Target defines the target texture, either ?GL_TEXTURE_1D , ?GL_TEXTURE_2D, ?GL_TEXTURE_1D_ARRAY, ?GL_TEXTURE_2D_ARRAY, ?GL_TEXTURE_RECTANGLE , or ?GL_TEXTURE_3D. The following symbols are accepted in Pname :
?GL_TEXTURE_BASE_LEVEL: Specifies the index of the lowest defined mipmap level. This is an integer value. The initial value is 0.
?GL_TEXTURE_BORDER_COLOR: The data in Params specifies four values that define the border values that should be used for border texels. If a texel is sampled from the border of the texture, the values of ?GL_TEXTURE_BORDER_COLOR are interpreted as an RGBA color to match the texture's internal format and substituted for the non-existent texel data. If the texture contains depth components, the first component of ?GL_TEXTURE_BORDER_COLOR is interpreted as a depth value. The initial value is ( 0.0, 0.0, 0.0, 0.0 ).
If the values for ?GL_TEXTURE_BORDER_COLOR are specified with gl:texParameterIiv or gl:texParameterIuiv, the values are stored unmodified with an internal data type of integer. If specified with gl:texParameteriv, they are converted to floating point with the following equation: f=2 c+1 2 b-/1. If specified with gl:texParameterfv , they are stored unmodified as floating-point values.
?GL_TEXTURE_COMPARE_FUNC: Specifies the comparison operator used when ?GL_TEXTURE_COMPARE_MODE is set to ?GL_COMPARE_REF_TO_TEXTURE. Permissible values are:
Texture Comparison FunctionComputed result?GL_LEQUAL result={1.0 0.0 r<=(D t) r>(D t))
?GL_GEQUAL result={1.0 0.0 r>=(D t) r<(D t))
?GL_LESS result={1.0 0.0 r<(D t) r>=(D t))
?GL_GREATER result={1.0 0.0 r>(D t) r<=(D t))
?GL_EQUAL result={1.0 0.0 r=(D t) r≠ (D t))
?GL_NOTEQUAL result={1.0 0.0 r≠(D t) r=(D t))
?GL_ALWAYS result=1.0
?GL_NEVER result=0.0
where r is the current interpolated texture coordinate, and D t is the depth texture value sampled from the currently bound depth texture. result is assigned to the the red channel.
?GL_TEXTURE_COMPARE_MODE: Specifies the texture comparison mode for currently bound depth textures. That is, a texture whose internal format is ?GL_DEPTH_COMPONENT_* ; see gl:texImage2D/9 ) Permissible values are:
?GL_COMPARE_REF_TO_TEXTURE: Specifies that the interpolated and clamped r texture coordinate should be compared to the value in the currently bound depth texture. See the discussion of ?GL_TEXTURE_COMPARE_FUNC for details of how the comparison is evaluated. The result of the comparison is assigned to the red channel.
?GL_NONE: Specifies that the red channel should be assigned the appropriate value from the currently bound depth texture.
?GL_TEXTURE_LOD_BIAS: Params specifies a fixed bias value that is to be added to the level-of-detail parameter for the texture before texture sampling. The specified value is added to the shader-supplied bias value (if any) and subsequently clamped into the implementation-defined range [( - bias max)(bias max)], where bias max is the value of the implementation defined constant ?GL_MAX_TEXTURE_LOD_BIAS. The initial value is 0.0.
?GL_TEXTURE_MIN_FILTER: The texture minifying function is used whenever the level-of-detail function used when sampling from the texture determines that the texture should be minified. There are six defined minifying functions. Two of them use either the nearest texture elements or a weighted average of multiple texture elements to compute the texture value. The other four use mipmaps.
A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2 n×2 m, there are max(n m)+1 mipmaps. The first mipmap is the original texture, with dimensions 2 n×2 m. Each subsequent mipmap has dimensions 2(k-1)×2(l-1), where 2 k×2 l are the dimensions of the previous mipmap, until either k=0 or l=0. At that point, subsequent mipmaps have dimension 1×2(l-1) or 2(k-1)×1 until the final mipmap, which has dimension 1×1. To define the mipmaps, call gl:texImage1D/8 , gl:texImage2D/9 , gl:texImage3D/10 , gl:copyTexImage1D/7 , or gl:copyTexImage2D/8 with the level argument indicating the order of the mipmaps. Level 0 is the original texture; level max(n m) is the final 1×1 mipmap.
Params supplies a function for minifying the texture as one of the following:
?GL_NEAREST: Returns the value of the texture element that is nearest (in Manhattan distance) to the specified texture coordinates.
?GL_LINEAR: Returns the weighted average of the four texture elements that are closest to the specified texture coordinates. These can include items wrapped or repeated from other parts of a texture, depending on the values of ?GL_TEXTURE_WRAP_S and ?GL_TEXTURE_WRAP_T , and on the exact mapping.
?GL_NEAREST_MIPMAP_NEAREST: Chooses the mipmap that most closely matches the size of the pixel being textured and uses the ?GL_NEAREST criterion (the texture element closest to the specified texture coordinates) to produce a texture value.
?GL_LINEAR_MIPMAP_NEAREST: Chooses the mipmap that most closely matches the size of the pixel being textured and uses the ?GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the specified texture coordinates) to produce a texture value.
?GL_NEAREST_MIPMAP_LINEAR: Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the ?GL_NEAREST criterion (the texture element closest to the specified texture coordinates ) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
?GL_LINEAR_MIPMAP_LINEAR: Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the ?GL_LINEAR criterion (a weighted average of the texture elements that are closest to the specified texture coordinates) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
As more texture elements are sampled in the minification process, fewer aliasing artifacts will be apparent. While the ?GL_NEAREST and ?GL_LINEAR minification functions can be faster than the other four, they sample only one or multiple texture elements to determine the texture value of the pixel being rendered and can produce moire patterns or ragged transitions. The initial value of ?GL_TEXTURE_MIN_FILTER is ?GL_NEAREST_MIPMAP_LINEAR .
?GL_TEXTURE_MAG_FILTER: The texture magnification function is used whenever the level-of-detail function used when sampling from the texture determines that the texture should be magified. It sets the texture magnification function to either ?GL_NEAREST or ?GL_LINEAR (see below). ?GL_NEAREST is generally faster than ?GL_LINEAR , but it can produce textured images with sharper edges because the transition between texture elements is not as smooth. The initial value of ?GL_TEXTURE_MAG_FILTER is ?GL_LINEAR .
?GL_NEAREST: Returns the value of the texture element that is nearest (in Manhattan distance) to the specified texture coordinates.
?GL_LINEAR: Returns the weighted average of the texture elements that are closest to the specified texture coordinates. These can include items wrapped or repeated from other parts of a texture, depending on the values of ?GL_TEXTURE_WRAP_S and ?GL_TEXTURE_WRAP_T , and on the exact mapping.
?GL_TEXTURE_MIN_LOD: Sets the minimum level-of-detail parameter. This floating-point value limits the selection of highest resolution mipmap (lowest mipmap level). The initial value is -1000.
?GL_TEXTURE_MAX_LOD: Sets the maximum level-of-detail parameter. This floating-point value limits the selection of the lowest resolution mipmap (highest mipmap level). The initial value is 1000.
?GL_TEXTURE_MAX_LEVEL: Sets the index of the highest defined mipmap level. This is an integer value. The initial value is 1000.
?GL_TEXTURE_SWIZZLE_R: Sets the swizzle that will be applied to the r component of a texel before it is returned to the shader. Valid values for Param are ?GL_RED , ?GL_GREEN, ?GL_BLUE, ?GL_ALPHA, ?GL_ZERO and ?GL_ONE. If ?GL_TEXTURE_SWIZZLE_R is ?GL_RED, the value for r will be taken from the first channel of the fetched texel. If ?GL_TEXTURE_SWIZZLE_R is ?GL_GREEN , the value for r will be taken from the second channel of the fetched texel. If ?GL_TEXTURE_SWIZZLE_R is ?GL_BLUE, the value for r will be taken from the third channel of the fetched texel. If ?GL_TEXTURE_SWIZZLE_R is ?GL_ALPHA, the value for r will be taken from the fourth channel of the fetched texel. If ?GL_TEXTURE_SWIZZLE_R is ?GL_ZERO , the value for r will be subtituted with 0.0. If ?GL_TEXTURE_SWIZZLE_R is ?GL_ONE , the value for r will be subtituted with 1.0. The initial value is ?GL_RED.
?GL_TEXTURE_SWIZZLE_G: Sets the swizzle that will be applied to the g component of a texel before it is returned to the shader. Valid values for Param and their effects are similar to those of ?GL_TEXTURE_SWIZZLE_R. The initial value is ?GL_GREEN .
?GL_TEXTURE_SWIZZLE_B: Sets the swizzle that will be applied to the b component of a texel before it is returned to the shader. Valid values for Param and their effects are similar to those of ?GL_TEXTURE_SWIZZLE_R. The initial value is ?GL_BLUE .
?GL_TEXTURE_SWIZZLE_A: Sets the swizzle that will be applied to the a component of a texel before it is returned to the shader. Valid values for Param and their effects are similar to those of ?GL_TEXTURE_SWIZZLE_R. The initial value is ?GL_ALPHA .
?GL_TEXTURE_SWIZZLE_RGBA: Sets the swizzles that will be applied to the r, g, b, and a components of a texel before they are returned to the shader. Valid values for Params and their effects are similar to those of ?GL_TEXTURE_SWIZZLE_R, except that all channels are specified simultaneously. Setting the value of ?GL_TEXTURE_SWIZZLE_RGBA is equivalent (assuming no errors are generated) to setting the parameters of each of ?GL_TEXTURE_SWIZZLE_R , ?GL_TEXTURE_SWIZZLE_G, ?GL_TEXTURE_SWIZZLE_B, and ?GL_TEXTURE_SWIZZLE_A successively.
?GL_TEXTURE_WRAP_S: Sets the wrap parameter for texture coordinate s to either ?GL_CLAMP_TO_EDGE , ?GL_CLAMP_TO_BORDER, ?GL_MIRRORED_REPEAT, or ?GL_REPEAT. ?GL_CLAMP_TO_EDGE causes s coordinates to be clamped to the range [(1 2/N) 1-(1 2/N)], where N is the size of the texture in the direction of clamping. ?GL_CLAMP_TO_BORDER evaluates s coordinates in a similar manner to ?GL_CLAMP_TO_EDGE. However, in cases where clamping would have occurred in ?GL_CLAMP_TO_EDGE mode, the fetched texel data is substituted with the values specified by ?GL_TEXTURE_BORDER_COLOR. ?GL_REPEAT causes the integer part of the s coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. ?GL_MIRRORED_REPEAT causes the s coordinate to be set to the fractional part of the texture coordinate if the integer part of s is even; if the integer part of s is odd, then the s texture coordinate is set to 1- frac(s), where frac(s) represents the fractional part of s. Initially, ?GL_TEXTURE_WRAP_S is set to ?GL_REPEAT.
?GL_TEXTURE_WRAP_T: Sets the wrap parameter for texture coordinate t to either ?GL_CLAMP_TO_EDGE , ?GL_CLAMP_TO_BORDER, ?GL_MIRRORED_REPEAT, or ?GL_REPEAT. See the discussion under ?GL_TEXTURE_WRAP_S. Initially, ?GL_TEXTURE_WRAP_T is set to ?GL_REPEAT.
?GL_TEXTURE_WRAP_R: Sets the wrap parameter for texture coordinate r to either ?GL_CLAMP_TO_EDGE , ?GL_CLAMP_TO_BORDER, ?GL_MIRRORED_REPEAT, or ?GL_REPEAT. See the discussion under ?GL_TEXTURE_WRAP_S. Initially, ?GL_TEXTURE_WRAP_R is set to ?GL_REPEAT.
See external documentation.
texParameteri(Target, Pname, Param) -> ok
See texParameterf/3
texParameterfv(Target, Pname, Params) -> ok
See texParameterf/3
texParameteriv(Target, Pname, Params) -> ok
See texParameterf/3
getTexParameterfv(Target, Pname) -> {float(), float(), float(), float()}
Return texture parameter values
gl:getTexParameter returns in Params the value or values of the texture parameter specified as Pname . Target defines the target texture. ?GL_TEXTURE_1D, ?GL_TEXTURE_2D, ?GL_TEXTURE_3D, ?GL_TEXTURE_1D_ARRAY, ?GL_TEXTURE_2D_ARRAY , ?GL_TEXTURE_RECTANGLE, ?GL_TEXTURE_CUBE_MAP, ?GL_TEXTURE_CUBE_MAP_ARRAY specify one-, two-, or three-dimensional, one-dimensional array, two-dimensional array, rectangle, cube-mapped or cube-mapped array texturing, respectively. Pname accepts the same symbols as gl:texParameterf/3 , with the same interpretations:
?GL_TEXTURE_MAG_FILTER: Returns the single-valued texture magnification filter, a symbolic constant. The initial value is ?GL_LINEAR.
?GL_TEXTURE_MIN_FILTER: Returns the single-valued texture minification filter, a symbolic constant. The initial value is ?GL_NEAREST_MIPMAP_LINEAR.
?GL_TEXTURE_MIN_LOD: Returns the single-valued texture minimum level-of-detail value. The initial value is -1000.
?GL_TEXTURE_MAX_LOD: Returns the single-valued texture maximum level-of-detail value. The initial value is 1000.
?GL_TEXTURE_BASE_LEVEL: Returns the single-valued base texture mipmap level. The initial value is 0.
?GL_TEXTURE_MAX_LEVEL: Returns the single-valued maximum texture mipmap array level. The initial value is 1000.
?GL_TEXTURE_SWIZZLE_R: Returns the red component swizzle. The initial value is ?GL_RED .
?GL_TEXTURE_SWIZZLE_G: Returns the green component swizzle. The initial value is ?GL_GREEN .
?GL_TEXTURE_SWIZZLE_B: Returns the blue component swizzle. The initial value is ?GL_BLUE .
?GL_TEXTURE_SWIZZLE_A: Returns the alpha component swizzle. The initial value is ?GL_ALPHA .
?GL_TEXTURE_SWIZZLE_RGBA: Returns the component swizzle for all channels in a single query.
?GL_TEXTURE_WRAP_S: Returns the single-valued wrapping function for texture coordinate s, a symbolic constant. The initial value is ?GL_REPEAT.
?GL_TEXTURE_WRAP_T: Returns the single-valued wrapping function for texture coordinate t, a symbolic constant. The initial value is ?GL_REPEAT.
?GL_TEXTURE_WRAP_R: Returns the single-valued wrapping function for texture coordinate r, a symbolic constant. The initial value is ?GL_REPEAT.
?GL_TEXTURE_BORDER_COLOR: Returns four integer or floating-point numbers that comprise the RGBA color of the texture border. Floating-point values are returned in the range [0 1]. Integer values are returned as a linear mapping of the internal floating-point representation such that 1.0 maps to the most positive representable integer and -1.0 maps to the most negative representable integer. The initial value is (0, 0, 0, 0).
?GL_TEXTURE_COMPARE_MODE: Returns a single-valued texture comparison mode, a symbolic constant. The initial value is ?GL_NONE. See gl:texParameterf/3 .
?GL_TEXTURE_COMPARE_FUNC: Returns a single-valued texture comparison function, a symbolic constant. The initial value is ?GL_LEQUAL. See gl:texParameterf/3 .
In addition to the parameters that may be set with gl:texParameterf/3 , gl:getTexParameter accepts the following read-only parameters:
?GL_TEXTURE_IMMUTABLE_FORMAT: Returns non-zero if the texture has an immutable format. Textures become immutable if their storage is specified with gl:texStorage1D/4 , gl:texStorage2D/5 or gl:texStorage3D/6 . The initial value is ?GL_FALSE .
See external documentation.
getTexParameteriv(Target, Pname) -> {integer(), integer(), integer(), integer()}
getTexLevelParameterfv(Target, Level, Pname) -> {float()}
Return texture parameter values for a specific level of detail
gl:getTexLevelParameter returns in Params texture parameter values for a specific level-of-detail value, specified as Level . Target defines the target texture, either ?GL_TEXTURE_1D, ?GL_TEXTURE_2D, ?GL_TEXTURE_3D, ?GL_PROXY_TEXTURE_1D , ?GL_PROXY_TEXTURE_2D, ?GL_PROXY_TEXTURE_3D, ?GL_TEXTURE_CUBE_MAP_POSITIVE_X , ?GL_TEXTURE_CUBE_MAP_NEGATIVE_X, ?GL_TEXTURE_CUBE_MAP_POSITIVE_Y, ?GL_TEXTURE_CUBE_MAP_NEGATIVE_Y , ?GL_TEXTURE_CUBE_MAP_POSITIVE_Z, ?GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or ?GL_PROXY_TEXTURE_CUBE_MAP .