September 2018
Intermediate to advanced
472 pages
15h 36m
English
To create a shader program that will generate a Bezier curve from a patch of four control points, use the following steps:
layout (location = 0 ) in vec2 VertexPosition;
void main() {
gl_Position = vec4(VertexPosition, 0.0, 1.0);
}
layout( vertices=4 ) out; uniform int NumSegments; uniform int NumStrips; void main() { // Pass along the vertex position unmodified gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; // Define the tessellation levels gl_TessLevelOuter[0] = float(NumStrips); gl_TessLevelOuter[1] = float(NumSegments); ...Read now
Unlock full access