Graphics Reference
In-Depth Information
When variables are interpolated in the fragment shader, you can choose
different interpolation techniques with the interpolation qualifiers cen-
troid, flat, invariant, or nonperspective. The differences are discussed in
Chapter 8.
There is now a layout qualifier that can be applied to either in or out vari-
ables for some shaders. This qualifier's effect varies considerably between
shader types, but it includes specifying the position of a vertex shader
input variable in an array, defining the input and output properties for a
geometry shader, or the input coordinates of a pixel in a fragment shader.
16-bit floats and 16-bit floating point variables are added, which have less
precision than 32-bit floats but are more compact and faster to compute.
This version also includes significant revisions of the GLSL standard,
moving it away from fixed-function OpenGL by deprecating a number of
capabilities that mirrored fixed-function operations. Because of the large num-
ber of applications that were built with earlier versions of OpenGL and GLSL,
however, this version also supports compatibility mode operation that lets
you use these earlier versions. This topic uses GLSL 4.1, but we include several
notes in the appropriate chapters that describe compatibility-mode alterna-
tives. These notes are marked with flags like the one in the margin. Among the
capabilities that have been deprecated are
any use of the fixed-function vertex or fragment operations; you now
need to use shaders for everything,
the use of glBegin / glEnd to define primitives; you now need to use ver-
tex arrays and vertex buffers for your geometry,
use of quad or polygon primitives; you now only use triangles,
use of display lists; you now use vertex arrays and vertex buffers,
use of most of the built-in atribute and uniform variables in GLSL; you
now need to define all these in your application and pass them all into
your shaders.
While these features are deprecated, and are thus not guaranteed to be avail-
able in all future versions, you really need not be afraid to use them. They are
said to be going away “at some future time,” but there is some feeling that this
might end up meaning, “when the sun burns itself out.”
OpenGL 4.0/GLSL 4.00
OpenGL 4.0 introduces the inal kind of shaders discussed in this topic: tessel-
lation shaders. These let you generate new geometry to provide greater detail
in your geometry, and are covered in Chapter 13. One object of this version
Search WWH ::




Custom Search