Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

WebGL

Our volunteers haven't translated this article into Tiếng Việt yet. Join us and help get the job done!

When trying to describe WebGL (and its parent technology OpenGL) we often say that it is a technology for drawing 3D graphics and applying visual effects to it, such as lighting, texturing, shadows, and so on. This is probably its most common use.

In fact, WebGL is much more than that. It is a Web API that allows you to directly communicate with the graphics hardware, the GPU. It comes with its own small programming language, called GLSL, which means you can now wield the computational power of the GPU, and use it as you wish. 2D and 3D graphics, image processing, procedural texturing, terrain generation, visual effects such as reflections, refraction, smoke, fire, and fluids, or even non-graphic general computing that takes advantage of powerful GPU features, are all possible. You are limited only by the power of the hardware and by your imagination.

With great power comes great responsibility. It is the purpose of these tutorials to give you the fundamental knowledge of how WebGL works, and how to use it correctly, so you can get the most out of it.

The basics

Start here if you are not familiar with OpenGL or WebGL:

Required background:
Getting started with the web – In the tutorials we are going to use very simple HTML and CSS, so it is enough to have a basic understanding of these technologies.
JavaScript – In contrast, WebGL is a JavaScript API, and so we are going to see and write lots of JavaScript. You should therefore have a solid grasp of the JavaScript language, particularly functions, arrays, and events. Good understanding of closures, objects, constructors, and the prototype chain would also occasionally help.
WebGL by example
This is a collection of live samples with short commentaries, sorted by topic and level of difficulty. It aims at showcasing WebGL concepts and capabilities, but it is not a substitute for the full tutorial.
Tutorial at API reference
This is the WebGL tutorial on the WebGL API reference pages. It is designed for those who are familiar with OpenGL, and wish to learn the equivalent JavaScript API.

In depth

Once you've mastered the basics, there is plenty more to explore:

WebGL API reference
The WebGL reference pages contain detailed description on every interface, method, property and constant in the WebGL API. In addition, you will find there articles on advanced topics, more examples, and tips on using WebGL.
Guide to Graphics on the Web
This is the Web developer guide to Graphics on the Web. You can learn there about other graphics APIs, such as SVG, 2D graphics with HTML Canvas, and video.
Game development
These are the Game development pages on MDN. Go there to learn about integrating WebGL with other APIs and techniques, so you can build a complete immersive experience, that you can distribute to others.

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, fscholz, ifilin
 Last updated by: chrisdavidmills,