
- •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.15. VERTEX SHADERS |
88 |
A shader should not fail to compile, and a program object should not fail to link due to lack of instruction space or lack of temporary variables. Implementations should ensure that all valid shaders and program objects may be successfully compiled, linked and executed.
Undefined Behavior
When using array or matrix variables in a shader, it is possible to access a variable with an index computed at run time that is outside the declared extent of the variable. Such out-of-bounds reads will return undefined values; out-of-bounds writes will have undefined results and could corrupt other variables used by shader or the GL. The level of protection provided against such errors in the shader is implementation-dependent.
2.15.5 Required State
The GL maintains state to indicate which shader and program object names are in use. Initially, no shader or program objects exist, and no names are in use.
The state required per shader object consists of:
•An unsigned integer specifying the shader object name.
•An integer holding the value of SHADER TYPE.
•A boolean holding the delete status, initially FALSE.
•A boolean holding the status of the last compile, initially FALSE.
•An array of type char containing the information log, initially empty.
•An integer holding the length of the information log.
•An array of type char containing the concatenated shader string, initially empty.
•An integer holding the length of the concatenated shader string.
The state required per program object consists of:
•An unsigned integer indicating the program object object name.
•A boolean holding the delete status, initially FALSE.
•A boolean holding the status of the last link attempt, initially FALSE.
Version 2.0 - October 22, 2004
2.15. VERTEX SHADERS |
89 |
•A boolean holding the status of the last validation attempt, initally FALSE.
•An integer holding the number of attached shader objects.
•A list of unsigned integers to keep track of the names of the shader objects attached.
•An array of type char containing the information log, initially empty.
•An integer holding the length of the information log.
•An integer holding the number of active uniforms.
•For each active uniform, three integers, holding its location, size, and type, and an array of type char holding its name.
•An array of words that hold the values of each active uniform.
•An integer holding the number of active attributes.
•For each active attbribute, three integers holding its location, size, and type, and an array of type char holding its name.
Additional state required to support vertex shaders consists of:
•A bit indicating whether or not vertex program two-sided color mode is enabled, initially disabled.
•A bit indicating whether or not vertex program point size mode (section 3.3.1) is enabled, initially disabled.
Additionally, one unsigned integer is required to hold the name of the current program object, if any.
Version 2.0 - October 22, 2004