Help end child hunger

GLSL Core Tutorial – Communication Application => Shader

Prev: Subroutines Next: Attribute Variables
 

The shader pipepline receives vertices as inputs. These vertices have one or more attributes. Furthermore OpenGL allows the definition of variables that are not associated to the vertices but are required to compute the shader effect. An example for such a variable could be a light’s position.

From a GLSL point of view variables come in two flavours:

  • attributes
  • uniforms

A uniform variable is constant for all vertices in an OpenGL draw call. It may be viewed as a global variable whose values do not change for every vertex in an OpenGL draw call. Examples of these type of variables are transformation matrices, light’s attributes, fog settings, and variables such as gravity and speed, etc…

Uniform variables can also be grouped in blocks allowing a more effective data setup and transfer from the application to the shader.

An attribute is specific for a vertex, and typically varies from vertex to vertex. The most obvious is the vertex position. Texture coordinates and normals are also amongst common vertex attributes. These are written in buffers and bounded to a particular shader attribute.

 

Prev: Subroutines Next: Attribute Variables
 

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha