2D and 3D Programming Using WebGL
Learn to render 2D and 3D graphics in the browser with WebGL and Three.js, covering shaders, transformations, textures and lighting.
WebGL is a JavaScript API that lets a compatible web browser render interactive 2D and 3D graphics without plug-ins, yet putting a single shape on the canvas takes several steps. You prepare the canvas and the WebGL context, store geometry in a buffer object, compile shader programs and link them to that buffer, then draw. Points, lines, triangles, a quad and a 3D cube follow, and the later lessons add color, textures, movement and ambient light, with Three.js helping to display animated 3D scenes.
What You Will Achieve
- Set up a quick local server and a WebGL project on Windows, Mac or Linux
- Render a shape by compiling shader programs and linking them to a buffer object
- Use Three.js to load models and display animated 3D graphics in a browser
- Move, scale and light objects, and respond to mouse and keyboard events
Program Overview
WebGL Setup and Drawing Objects
Compares WebGL with OpenGL and OpenGL ES, prepares a server and project, and works through the rendering steps for basic shapes.
- WebGL, OpenGL and OpenGL ES compared
- Server setup on Windows, Mac and Linux
- The six rendering steps and normalized versus device coordinates
- Points, lines, triangles, a quad, a 3D cube and Three.js models
Color, Textures, Transformations and Lighting
Adds color and texture to shapes, then moves the scene with transformations, a camera, input events and ambient light.
- One color per triangle and textures on shapes
- Right-hand and left-hand coordinate systems
- Translation, scaling and combined transformations
- Mouse and keyboard events, camera, lighting and shading
Certificate Awarded (Paid)
Pass the course assessment to earn it. The course is free to study; the certificate is optional and has a fee.
Job Outlook
Interactive browser graphics are used in animation and gaming, education and training, film, and architecture and interior design, where developers build 2D and 3D scenes that run without plug-ins.
- Front End Developer
- Computer Programmer
Good for: Web developers who want to see how browser graphics are built step by step, starting with raw WebGL calls before bringing in Three.js.
Keep in mind: The lessons are video walkthroughs, so code each example alongside them to make the shader and buffer steps stick; the lighting work centers on ambient light.
Bottom line: A practical walk through the WebGL rendering steps that ends with colored, textured and lit shapes you can move with the mouse and keyboard.
Frequently Asked Questions
How does WebGL relate to OpenGL and OpenGL ES?
WebGL is the web version of OpenGL: a JavaScript API that lets a compatible browser render interactive 2D and 3D graphics with no plug-ins. The opening lesson sets out how it differs from OpenGL and OpenGL ES.
What are the six steps to rendering in WebGL?
You prepare the canvas, get the WebGL context ready, specify the geometry and store it in a buffer object, create and compile the shader programs, link those programs with the buffer objects, and finally draw the object.
Where does Three.js come into the lessons?
You set up Three.js on your own computer and use it to load and draw models and to help create and display animated 3D graphics in a web browser on top of WebGL.



There are no reviews yet.