JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
Previous Page
Next Page

Chapter 4. The OpenGL Programmable Pipeline

With contributions by Barthold Lichtenbelt

The OpenGL Shading Language is designed specifically for use with OpenGL. Vertex shader and fragment shader input and output are tied into the standard OpenGL pipeline in a well-defined manner. The basics of how the programmable processors fit into the OpenGL pipeline were covered in Section 2.3. This chapter discusses the details of that integration and the language mechanisms used to achieve it.

Applications can provide data to shaders with user-defined attribute variables and user-defined uniform variables. The OpenGL Shading Language also provides built-in variables that can communicate between the programmable processors and the surrounding fixed functionality in the following ways.

  • Standard OpenGL attributes can be accessed from within a vertex shader by means of built-in attribute variable names.

  • A variety of OpenGL state is accessible from either vertex shaders or fragment shaders by means of built-in uniform variables.

  • Vertex shaders communicate to subsequent processing in OpenGL through the use of special built-in vertex shader output variables and built-in varying variables.

  • Fragment shaders obtain the results from the preceding processing through special built-in fragment shader input variables and built-in varying variables.

  • Fragment shaders communicate results to subsequent processing stages of OpenGL through special fragment shader output variables.

  • Built-in constants are accessible from within both types of shaders and define some of the same implementation-dependent constants that are accessible with OpenGL's glGet function.

All the built-in identifiers begin with the reserved prefix "gl_" to set them apart.


Previous Page
Next Page



R7
JavaScript EditorAjax Editor     JavaScript Editor