December 2013
Intermediate to advanced
116 pages
2h 15m
English
Vertex shaders can output generic values to the next stage. Those values are going to be passed to the geometry shading stage first, then rasterized, and finally passed to the fragment shading stage in one of the allowed interpolation fashions. You can choose the kind of interpolation, but we will use in this book a linear perspective-corrected interpolation.
To specify an output variable, you must use the interpolation type along with the out keyword:
#version 430 #pragma debug(on) #pragma optimize(off) layout (location = 0) in vec4 Position; layout (location = 1) in vec2 TexCoord; uniform mat4 Modelview; uniform mat4 Projection; // smooth = linearly perspective-correct interpolation smooth out vec2 texCoordsInterpolated; ...
Read now
Unlock full access