Jump to: navigation, search

Howto:Shader programming in FlightGear

602 bytes added, 14:12, 27 March 2010
Vertex Shaders
Restrictions: Cannot access any vertex other than the current one
Note: Loading a vertex shader turns off parts of the OpenGL pipeline (vertex shaders fully replace the "TTexturing &L UnitLighting unit")
Vertex shaders operate on every each vertex, the vertex shader is executed for each every vertex related OpenGL call (e.g. glVertex* or glDrawArrays).Accordingly, this means for example, that for meshes that contain e.g. 5000 vertices, the vertex shader will also be executed 5000 times. A single vertex itself is composed of a number of "attributes" (vertex attrib), such as: position, texture coordinates, normal and color for the most common. The position (attribute) is the most important one. The coordinates (x, y and z) of the vertex's entering position are those which have been given by the 3D modeler during the creation of the 3D model. The vertex's position is defined in the local space of the mesh (or object space).  A vertex shader provides almost full control over what is happening with each vertex. Consequently, all Perper-Vertex vertex operations of the fixed function OpenGL pipeline are replaced by the custom vertex shader.
Vertex Shaders take application geometry and per-vertex attributes as input and transform the input data in some meaningful way.

Navigation menu