25.02.2013 Views

Peter Lubbers - Pro HTML 5 Programming

Pro HTML 5 Programming

Pro HTML 5 Programming

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 11-1. Quake II<br />

3D Shaders<br />

CHAPTER 11 ■ THE FUTURE OF <strong>HTML</strong>5<br />

WebGL is a binding for OpenGL ES 2 in JavaScript, so it uses the programmable graphics pipeline that is<br />

standardized in OpenGL, including shaders. Shaders allow highly flexible rendering effects to be applied<br />

to a 3D scene, increasing the realism of the display. WebGL shaders are written in GL Shading Language<br />

(GLSL). This adds yet another single-purpose language to the web stack. An <strong>HTML</strong>5 application with<br />

WebGL consists of <strong>HTML</strong> for structure, CSS for style, JavaScript for logic, and GLSL for shaders.<br />

Developers can transfer their knowledge of OpenGL shaders to a similar API in a web environment.<br />

WebGL is likely to be a foundational layer for 3D graphics on the Web. Just as JavaScript libraries<br />

have abstracted over DOM and provided powerful high-level constructs, there are libraries providing<br />

additional functionality on top of WebGL. Libraries are currently under development for scene graphs,<br />

3D file formats such as COLLADA, and complete engines for game development. Figure 11-2 shows<br />

Shader Toy—a WebGL shader workbench built by Inigo Quilez that comes with shaders by nine other<br />

demoscene artists. This particular screenshot shows Leizex by Rgba. We can expect an explosion of highlevel<br />

rendering libraries that bring 3D scene creation power to novice Web programmers in the near<br />

future.<br />

261

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!