Graphics Reference
In-Depth Information
Figure 13.18. Three sphere octants with radius 1.0, 1.5, and 2.0 respectively. Regardless of tessellation level,
each triangle is about the same size because the tessellation levels depend on the sphere radius.
Whole-Sphere Subdivision
A second sphere-subdivision example shows a different way to develop
geometry from a tessellation shader. This example creates three spheres, each
of which is defined by a single vertex in the patch vertex list. Each vertex is a
vec4 value with center at ( x , y , z ) and with radius w , which is sufficient to define
a sphere. We will see how this is handled in the TES. The .glib file for this
example defines a set of uniform slider variables and is
##OpenGL GLIB
Vertex spheresubd.vert
TessControl spheresubd.tcs
TessEvaluation spheresubd.tes
Geometry spheresubd.geom
Fragment spheresubd.frag
Program SphereSubd \
uDetail <1. 30. 200.> \
uScale <0.1 1. 10.> \
uShrink <0. 1. 1.> \
uLightX <-10. 5. 10.> \
uLightY <-10. 10. 10.> \
uLightZ <-10. 10. 10.>
NumPatchVertices 1
Search WWH ::




Custom Search