Learn WebGL¶
The traditional approach to learning a subject is to divide the topic into sub-topics, study each sub-topic, and then show how the sub-topics relate to each other. That is not the approach for these tutorials. These tutorials start with the “big picture” and then study the details of each sub-system that composes the complex overall system. The study of each sub-system starts from basic principles and tries to avoid any assumptions about what the student knows or does not know.
Why learn WebGL? Very simply, it is the only cross platform solution for producing real-time, 3D computer graphics we have.
- You could learn Direct3D, which is a proprietary system made by Microsoft, but you would be restricted to running your software on a Microsoft based computer.
- You could learn OpenGL, which is cross platform, but OpenGL does not have a definitive way to interface to an operating system’s user interface.
WebGL is an offspring of OpenGL that executes in all modern web browsers, including web browsers on tablets and phones. Therefore, when you learn WebGL, you are learning OpenGL for an environment that basically will execute on all modern computing devices. That is really cool!!!
These tutorials are designed to be studied in sequence because they build on each other.
- We start with the “big picture” to show the critical sub-systems of any WebGL web page.
- Then we isolate the details in an individual sub-system and attempt to make sense of why it is designed like it is and how it works.
Note: WebGL requires programming and you are encouraged to experiment with sample code at each stage of your learning. Good programming practices use an incremental development cycle. You start development with a simple working program and use a simple cycle of implement/test, implement/test, implement/test, ... until you reach your goal. Rarely, if ever, should you program a complex WebGL program “from scratch.” Always start with a working program and add complexity slowly.
A critical idea for these lessons is that you MUST master a topic before moving to a new topic. If you are confused about even a small part of a topic, you will probably not understand the more complex topic that follow. So take your time and thoroughly master each topic before moving to the next topic.
Table of Contents¶
SECTION 1: The Big Picture¶
SECTION 2: Tools and Languages¶
SECTION 3: Model Data¶
SECTION 4: Modeling¶
SECTION 5: Rendering Basics¶
- 5.1 - Introduction to Rendering
- 5.2 - A Primer on Shaders
- 5.3 - A Primer on Buffer Objects
- 5.4 - A Simple Model
- 5.5 - Example 1: One Color per Model
- 5.6 - Example 2: One Color per Triangle
- 5.7 - Example 3: One Color per Vertex
- 5.8 - Example 4: Textures
- 5.9 - Interleaved Buffers
- 5.10 - Converting OBJ Model Data to Buffer Objects
SECTION 6: Model Transformations¶
- 6.1 - Introduction to Transformations
- 6.2 - Scaling
- 6.3 - Translating
- 6.4 - Rotating
- 6.5 - Transformation Matrices
- 6.6 - A Matrix Code Library - Learn_webgl_matrix
- 6.7 - Using Learn_webgl_matrix - A Robot Arm Base
- 6.8 - Chaining Transformations - Adding a Forearm
- 6.9 - Chaining Transformations - Adding an Upper Arm
- 6.10 - Chaining Transformations (Summary)
- 6.11 - More Matrix Math Concepts
- 6.12 - Coding Issues
SECTION 7: Cameras¶
SECTION 8: Projections and Viewports¶
SECTION 9: Lights¶
SECTION 10: Surface Properties¶
- 10.1 - Introduction to Surface Properties
- 10.2 - Surface Colors
- 10.3 - Smooth “Phong” Shading
- 10.4 - Texture Mapping Using Images
- 10.5 - Texture Mapping - Texture Coordinates
- 10.6 - Texture Mapping Using Procedures
- 10.7 - Texture Mapping Using Procedures - Continued
- 10.8 - Transformations on Texture Maps
- 10.9 - Other Surface Manipulations
- 10.10 - Combining Light and Surface Properties