Graphics Reference
In-Depth Information
Exercise 33.2: Write a vertex shader that alters the x -coordinate of each sur-
face point as a sinusoidal function of y and time (which you'll need to pass to the
shader from the host program, which will get the time from the system clock).
You'll write something like
gl_Position.x += sin(k1 * gl_Position.y - k2 * t);
which will produce waves of wavelength 2 k 1 , moving with velocity 2 k 2 .
Exercise 33.3: Write a vertex shader that draws each triangle in a different
(flat) color, specified by the host program. This can be very useful for debugging.
Search WWH ::




Custom Search