WebGL Fundamentals: 2D and 3D Graphics For The Web
Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape.
elements. This conformance makes it possible for the API to take advantage of hardware graphics acceleration provided by the user's device.
WebGL 2 is a major update to WebGL which is provided through the
interface. It is based on OpenGL ES 3.0 and new features include:
- 3D textures,
- Sampler objects,
- Uniform Buffer objects,
- Sync objects,
- Query objects,
- Transform Feedback objects,
- Promoted extensions that are now core to WebGL 2: Vertex Array objects, instancing, multiple render targets, fragment depth.
Guides and tutorials
Below, you'll find an assortment of guides to help you learn WebGL
concepts and tutorials that offer step-by-step lessons and examples.
A guide to variables, buffers, and other types of data used when writing WebGL code.
Tips and suggestions to help you improve the quality, performance, and reliability of your WebGL content.
A guide to using WebGL extensions.
A beginner's guide to WebGL core concepts. A good place to start if you don't have previous WebGL experience.
This example demonstrates the simple animation of a one-color shape. Topics examined are adapting to aspect ratio differences, a function to build shader programs from sets of multiple shaders, and the basics of drawing in WebGL.
A series of live samples with short explanations that showcase WebGL concepts and capabilities. The examples are sorted according to topic and level of difficulty, covering the WebGL rendering context, shader programming, textures, geometry, user interaction, and more.Advanced tutorialsWebGL model view projection
A detailed explanation of the three core matrices that are typically used to represent a 3D object view: the model, view and projection matrices.
A useful guide to how 3D transform matrices work, and can be used on the web — both for WebGL calculations and in CSS3 transforms.
- Raw WebGL: An introduction to WebGL A talk by Nick Desaulniers that introduces the basics of WebGL. This is a great place to start if you've never done low-level graphics
- Khronos WebGL site The main web site for WebGL at the Khronos Group.
- WebGL Fundamentals A basic tutorial with fundamentals of WebGL.
- WebGL playground An online tool for creating and sharing WebGL projects. Good for quick prototyping and experimenting.
- WebGL Stats A site with statistics about WebGL capabilities in browsers on different platforms.
- PhiloGL is a WebGL framework for data visualization, creative coding, and game development.
- Pixi.js is a fast, open-source 2D WebGL renderer.
- PlayCanvas is an open-source game engine.
- Sylvester is an open-source library for manipulating vectors and matrices. Not optimized for WebGL but extremely robust.
- three.js is an open-source, fully featured 3D WebGL library.
- Phaser is a fast, free and fun open source framework for Canvas and WebGL powered browser games.
- RedGL is an open-source 3D WebGL library.
In addition to the browser, the GPU itself also needs to support the feature. So, for example, S3 Texture Compression (S3TC) is only available on Tegra-based tablets. Most browsers make the
context available through the webgl context name, but older ones need
as well. In addition, the upcoming WebGL 2
is fully backwards-compatible and will have the context name
WebGL debugging and testing
Starting with Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey
2.7), there are two preferences available which let you control the
capabilities of WebGL for testing purposes:
A Boolean property that, when
, enables a minimum capability mode. When in this mode, WebGL is configured to only support the bare minimum feature set and capabilities required by the WebGL specification. This lets you ensure that your WebGL code will work on any device or browser, regardless of their capabilities. This is
A Boolean property that, when
, disables all WebGL extensions. This is
Subscribe to get your daily round-up of top tech stories!