更新时间:2021-06-10 19:44:05
coverpage
Title Page
Dedication
Packt Upsell
Why Subscribe?
Packt.com
Foreword
Contributors
About the Authors
About the Reviewers
Packt Is Searching for Authors like You
Preface
Who This Book Is For
What This Book Covers
To Get the Most out of This Book
Download the Example Code Files
Running Examples Locally
Download the Color Images
Conventions Used
Sections
Time for Action
Have a Go
Get in Touch
Reviews
Getting Started
System Requirements
WebGL Rendering
Software and Hardware Based Rendering
Server and Client Based Rendering
Retained and Immediate Mode Rendering
Retained-Mode Rendering
Immediate-Mode Rendering
Retained Versus Immediate Mode Rendering
Elements in a WebGL Application
Time for Action: Creating an HTML5 Canvas Element
Defining a CSS Style
Understanding Canvas Attributes
What If Canvas Is Not Supported?
Time for Action: Accessing the WebGL Context
State Machine
Time for Action: Setting up WebGL Context Attributes
Using the Context to Access the WebGL API
Loading a 3D Scene
Virtual Car Showroom
Time for Action: Visualizing a 3D Showroom
Architecture Updates
Summary
Rendering
WebGL Rendering Pipeline
Vertex Buffer Objects (VBOs)
Index Buffer Objects (IBOs)
Vertex Shader
Fragment Shader
Framebuffer
Attributes
Uniforms
Textures
Varyings
Rendering in WebGL
Vertices
Indices
Defining a Geometry Using JavaScript Arrays
Creating WebGL Buffers
Operations to Manipulate WebGL Buffers
Associating Attributes to VBOs
Binding a VBO
Pointing an Attribute to the Currently-Bound VBO
Enabling the Attribute
Unbinding a VBO
Drawing Functions
Using drawArrays
Using drawElements
Putting Everything Together
Time for Action: Rendering a Square
Have a Go: Changing the Square Color
Have a Go: Rendering Using drawArrays
Vertex Array Objects
Time for Action: Rendering a Square Using a VAO
Time for Action: Rendering Modes
WebGL as a State Machine: Buffer Manipulation
Time for Action: Querying the State of Buffers
Have a Go: Add One Validation
Advanced Geometry-Loading Techniques
Introduction to JavaScript Object Notation (JSON)
Defining JSON-Based 3D Models
Time for Action: Encoding and Decoding JSON
Asynchronous Loading with AJAX
Setting up a Web Server
Working Around the Web Server Requirement
Time for Action: Loading a Cone with AJAX
Have a Go: Loading a Nissan GTR
Lights
Lights Normals and Materials
Positional Versus Directional Lights
Normals
Materials