
- •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
2.14. COLORS AND COLORING |
70 |
||
|
|
|
|
|
Primitive type of polygon i |
Vertex |
|
|
|
|
|
|
|
|
|
|
single polygon (i ≡ 1) |
1 |
|
|
triangle strip |
i + 2 |
|
|
triangle fan |
i + 2 |
|
|
independent triangle |
3i |
|
|
quad strip |
2i + 2 |
|
|
independent quad |
4i |
|
Table 2.12: Polygon flatshading color selection. The colors used for flatshading the ith polygon generated by the indicated Begin/End type are derived from the current color (if lighting is disabled) in effect when the indicated vertex is specified. If lighting is enabled, the colors are produced by lighting the indicated vertex. Vertices are numbered 1 through n, where n is the number of vertices between the
Begin/End pair.
2.14.8 Color and Associated Data Clipping
After lighting, clamping or masking and possible flatshading, colors are clipped. Those colors associated with a vertex that lies within the clip volume are unaffected by clipping. If a primitive is clipped, however, the colors assigned to vertices produced by clipping are clipped colors.
Let the colors assigned to the two vertices P1 and P2 of an unclipped edge be c1 and c2. The value of t (section 2.12) for a clipped point P is used to obtain the color associated with P as
c = tc1 + (1 − t)c2.
(For a color index color, multiplying a color by a scalar means multiplying the index by the scalar. For an RGBA color, it means multiplying each of R, G, B, and A by the scalar. Both primary and secondary colors are treated in the same fashion.) Polygon clipping may create a clipped vertex along an edge of the clip volume’s boundary. This situation is handled by noting that polygon clipping proceeds by clipping against one plane of the clip volume’s boundary at a time. Color clipping is done in the same way, so that clipped points always occur at the intersection of polygon edges (possibly already clipped) with the clip volume’s boundary.
Texture and fog coordinates, vertex shader varying variables (section 2.15.3), and point sizes computed on a per vertex basis must also be clipped when a primitive is clipped. The method is exactly analogous to that used for color clipping.
Version 2.0 - October 22, 2004