
- •Introduction
- •Formatting of Optional Features
- •What is the OpenGL Graphics System?
- •Our View
- •Companion Documents
- •OpenGL Operation
- •OpenGL Fundamentals
- •Floating-Point Computation
- •GL State
- •GL Command Syntax
- •Basic GL Operation
- •GL Errors
- •Begin/End Paradigm
- •Begin and End
- •Polygon Edges
- •GL Commands within Begin/End
- •Vertex Specification
- •Vertex Arrays
- •Buffer Objects
- •Vertex Arrays in Buffer Objects
- •Array Indices in Buffer Objects
- •Rectangles
- •Coordinate Transformations
- •Controlling the Viewport
- •Matrices
- •Normal Transformation
- •Generating Texture Coordinates
- •Clipping
- •Current Raster Position
- •Colors and Coloring
- •Lighting
- •ColorMaterial
- •Lighting State
- •Color Index Lighting
- •Clamping or Masking
- •Flatshading
- •Color and Associated Data Clipping
- •Final Color Processing
- •Vertex Shaders
- •Shader Objects
- •Program Objects
- •Shader Variables
- •Shader Execution
- •Required State
- •Rasterization
- •Invariance
- •Antialiasing
- •Multisampling
- •Points
- •Basic Point Rasterization
- •Point Rasterization State
- •Point Multisample Rasterization
- •Line Segments
- •Basic Line Segment Rasterization
- •Other Line Segment Features
- •Line Rasterization State
- •Line Multisample Rasterization
- •Polygons
- •Basic Polygon Rasterization
- •Stippling
- •Antialiasing
- •Options Controlling Polygon Rasterization
- •Depth Offset
- •Polygon Multisample Rasterization
- •Polygon Rasterization State
- •Pixel Rectangles
- •Pixel Storage Modes
- •The Imaging Subset
- •Pixel Transfer Modes
- •Rasterization of Pixel Rectangles
- •Pixel Transfer Operations
- •Pixel Rectangle Multisample Rasterization
- •Bitmaps
- •Texturing
- •Compressed Texture Images
- •Texture Parameters
- •Depth Component Textures
- •Cube Map Texture Selection
- •Texture Wrap Modes
- •Texture Completeness
- •Texture State and Proxy State
- •Texture Objects
- •Texture Environments and Texture Functions
- •Texture Comparison Modes
- •Texture Application
- •Color Sum
- •Fragment Shaders
- •Shader Variables
- •Shader Execution
- •Antialiasing Application
- •Multisample Point Fade
- •Per-Fragment Operations
- •Pixel Ownership Test
- •Scissor Test
- •Multisample Fragment Operations
- •Alpha Test
- •Stencil Test
- •Depth Buffer Test
- •Occlusion Queries
- •Blending
- •Dithering
- •Logical Operation
- •Additional Multisample Fragment Operations
- •Whole Framebuffer Operations
- •Selecting a Buffer for Writing
- •Fine Control of Buffer Updates
- •Clearing the Buffers
- •The Accumulation Buffer
- •Drawing, Reading, and Copying Pixels
- •Writing to the Stencil Buffer
- •Reading Pixels
- •Copying Pixels
- •Pixel Draw/Read State
- •Special Functions
- •Evaluators
- •Selection
- •Feedback
- •Display Lists
- •Flush and Finish
- •Hints
- •State and State Requests
- •Querying GL State
- •Simple Queries
- •Data Conversions
- •Enumerated Queries
- •Texture Queries
- •Stipple Query
- •Color Matrix Query
- •Color Table Query
- •Convolution Query
- •Histogram Query
- •Minmax Query
- •Pointer and String Queries
- •Occlusion Queries
- •Buffer Object Queries
- •Shader and Program Queries
- •Saving and Restoring State
- •State Tables
- •Invariance
- •Corollaries
- •Version 1.1
- •Version 1.2
- •Imaging Subset
- •Version 1.2.1
- •Version 1.3
- •Version 1.4
- •Fog Coordinate
- •Texture LOD Bias
- •Version 1.5
- •Version 2.0
- •ARB Extensions
- •Texture Mirrored Repeat
- •OpenGL Shading Language

3.8. TEXTURING |
189 |
If the value of TEXTURE MAG FILTER is not NEAREST, or the value of
TEXTURE MIN FILTER is not NEAREST or NEAREST MIPMAP NEAREST, then r may be computed by comparing more than one depth texture value to the texture R coordinate. The details of this are implementation-dependent, but r should be a value in the range [0, 1] which is proportional to the number of comparison passes or failures.
3.8.15 Texture Application
Texturing is enabled or disabled using the generic Enable and Disable commands, respectively, with the symbolic constants TEXTURE 1D, TEXTURE 2D, TEXTURE 3D, or TEXTURE CUBE MAP to enable the one-, two-, three-dimensional, or cube map texture, respectively. If both twoand one-dimensional textures are enabled, the two-dimensional texture is used. If the three-dimensional and either of the twoor one-dimensional textures is enabled, the three-dimensional texture is used. If the cube map texture and any of the three-, two-, or one-dimensional textures is enabled, then cube map texturing is used. If all texturing is disabled, a rasterized fragment is passed on unaltered to the next stage of the GL (although its texture coordinates may be discarded). Otherwise, a texture value is found according to the parameter values of the currently bound texture image of the appropriate dimensionality using the rules given in sections 3.8.6 through 3.8.9. This texture value is used along with the incoming fragment in computing the texture function indicated by the currently bound texture environment. The result of this function replaces the incoming fragment’s primary R, G, B, and A values. These are the color values passed to subsequent operations. Other data associated with the incoming fragment remain unchanged, except that the texture coordinates may be discarded.
Each texture unit is enabled and bound to texture objects independently from the other texture units. Each texture unit follows the precedence rules for one-, two- , three-dimensional, and cube map textures. Thus texture units can be performing texture mapping of different dimensionalities simultaneously. Each unit has its own enable and binding states.
Each texture unit is paired with an environment function, as shown in figure 3.11. The second texture function is computed using the texture value from the second texture, the fragment resulting from the first texture function computation and the second texture unit’s environment function. If there is a third texture, the fragment resulting from the second texture function is combined with the third texture value using the third texture unit’s environment function and so on. The texture unit selected by ActiveTexture determines which texture unit’s environment is modified by TexEnv calls.
Version 2.0 - October 22, 2004

3.8. TEXTURING |
190 |
Cf
CT0 |
|
|
TE0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TE |
1 |
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
||||||
CT1 |
|
|
|
|
|
|
|
|
TE |
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT2 |
|
|
|
|
|
|
|
|
|
|
|
|
TE3 |
|
C’f |
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
||||||
CT3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|||||||||
|
|
Cf |
= fragment primary color input to texturing |
|
|
|||||||||||
|
|
C’f |
= fragment color output from texturing |
|
|
CTi = texture color from texture lookup i
TEi = texture environment i
Figure 3.11. Multitexture pipeline. Four texture units are shown; however, multitexturing may support a different number of units depending on the implementation. The input fragment color is successively combined with each texture according to the state of the corresponding texture environment, and the resulting fragment color passed as input to the next texture unit in the pipeline.
If the value of TEXTURE ENV MODE is COMBINE, the texture function associated with a given texture unit is computed using the values specified by SRCn RGB,
SRCn ALPHA, OPERANDn RGB and OPERANDn ALPHA. If TEXTUREn is specified as
SRCn RGB or SRCn ALPHA, the texture value from texture unit n will be used in computing the texture function for this texture unit.
Texturing is enabled and disabled individually for each texture unit. If texturing is disabled for one of the units, then the fragment resulting from the previous unit is passed unaltered to the following unit. Individual texture units beyond those specified by MAX TEXTURE UNITS are always treated as disabled.
If a texture unit is disabled or has an invalid or incomplete texture (as defined in section 3.8.10) bound to it, then blending is disabled for that texture unit. If the texture environment for a given enabled texture unit references a disabled texture unit, or an invalid or incomplete texture that is bound to another unit, then the
Version 2.0 - October 22, 2004