Diagrams & Maps
Book Illustration
Page 6
3D Rotation Axes & WebGL sampler2D
These diagrams demonstrate three dimensional rotation axes
and WebGL texture sampling.
They were prepared for the books, 3D Programming for Beginners
and Simple Shaders
.
WebGL sampler2D
texture2D() Returns Sample at (S,T)
3D Rotation
Rotate Around X, Y, or Z Axes
WebGL sampler2D
The WebGL sampler2D
graphic, above,
demonstrates how the following
GLSL fragment shader (in the C language), below, samples the color of a lotus flower
at locations specified by coordinates, S and T.
Built-in function texture2D()
accesses the texture from u_sampler0
at coordinates (S,T), then
returns one color from the lotus.
That one color is then assigned to the built-in
variable gl_FragColor
.
precision mediump float; uniform sampler2D u_sampler0; varying vec2 v_tex_coord0; void main(void) { gl_FragColor = texture2D( u_sampler0, v_tex_coord0 ); }
Illustrated Books
Illustrated books bring concepts to life. See diagrams and maps prepared for Kindle books.