Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WebGL Beginner's Guide

You're reading from   WebGL Beginner's Guide If you're a JavaScript developer who wants to take the plunge into 3D web development, this is the perfect primer. From a basic understanding of WebGL structure to creating realistic 3D scenes, everything you need is here.

Arrow left icon
Product type Paperback
Published in Jun 2012
Publisher Packt
ISBN-13 9781849691727
Length 376 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (18) Chapters Close

WebGL Beginner's Guide
Credits
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with WebGL FREE CHAPTER 2. Rendering Geometry 3. Lights! 4. Camera 5. Action 6. Colors, Depth Testing, and Alpha Blending 7. Textures 8. Picking 9. Putting It All Together 10. Advanced Techniques Index

Structure of a WebGL application


As in any 3D graphics library, in WebGL, you need certain components to be present to create a 3D scene. These fundamental elements will be covered in the first four chapters of the book. Starting from Chapter 5, Action, we will cover elements that are not required to have a working 3D scene such as colors and textures and then later on we will move to more advanced topics.

The components we are referring to are as follows:

  • Canvas: It is the placeholder where the scene will be rendered. It is a standard HTML5 element and as such, it can be accessed using the Document Object Model (DOM) through JavaScript.

  • Objects: These are the 3D entities that make up part of the scene. These entities are composed of triangles. In Chapter 2, Rendering Geometry, we will see how WebGL handles geometry. We will use WebGL buffers to store polygonal data and we will see how WebGL uses these buffers to render the objects in the scene.

  • Lights: Nothing in a 3D world can be seen if there are no lights. This element of any WebGL application will be explored in Chapter 3, Lights!. We will learn that WebGL uses shaders to model lights in the scene. We will see how 3D objects reflect or absorb light according to the laws of physics and we will also discuss different light models that we can create in WebGL to visualize our objects.

  • Camera: The canvas acts as the viewport to the 3D world. We see and explore a 3D scene through it. In Chapter 4, Camera, we will understand the different matrix operations that are required to produce a view perspective. We will also understand how these operations can be modeled as a camera.

This chapter will cover the first element of our list—the canvas. We will see in the coming sections how to create a canvas and how to set up a WebGL context.

You have been reading a chapter from
WebGL Beginner's Guide
Published in: Jun 2012
Publisher: Packt
ISBN-13: 9781849691727
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime