O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beginning WebGL for HTML5

Book Description

Beginning WebGL for HTML5 gets you rapidly up to speed with WebGL, a powerful new graphics language within the browser. You'll render realistic scenes with advanced lighting models, shadows, blending and textures. You'll also use mathematics to model fractals and particle systems. Going beyond that, Beginning WebGL for HTML5 presents advanced vertex and fragment shader usage for creating stunning, top-end results.

You'll benefit from using modern frameworks to rapidly develop complex scenes, and make use of many tools to help improve rendering performance and debugging. Beginning WebGL for HTML5 builds your critical WebGL development skills while being enjoyable at each step of the way.

  • Quickly get up to speed with WebGL

  • Render realistic scenes

  • Work faster with frameworks

  • Improve rendering performance

  • What you'll learn

  • A scene setup and rendering refresher

  • Advanced GLSL usages

  • Rendering realistic scenes with lighting, blending, reflections, shadows and more

  • The current state of WebGL mobile support

  • Performance optimizations

  • Enhancing productivity by using existing frameworks and loading models

  • Who this book is for

    Beginning WebGL for HTML5 is for the graphics enthusiast who is ready to bring their skillset to the next level and create more realistic, beautiful scenes. Beginning WebGL for HTML5 is a great choice for someone with existing OpenGL or Canvas 2D knowledge wanting to transition to WebGL. It is an excellent choice for those wanting to have high performance graphics coded in minimal time.

    Table of Contents

    1. Title
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. Chapter 1: Setting the Scene
      1. A Blank Canvas
      2. Getting Context
      3. WebGL Components
      4. Rendering in Two Dimensions
      5. The View: Part I
      6. Adding Color
      7. Animation and Model Movement
      8. The View: Part II
      9. Three-Dimensional Rendering
      10. Summary
    10. Chapter 2: Shaders 101
      1. Graphics Pipelines
      2. GL Shading Language
      3. Basic Usage
      4. GLSL Specification in More Detail
      5. Built-in Functions
      6. Interactive GLSL Environs
      7. Procedural Shaders
      8. Summary
    11. Chapter 3: Textures and Lighting
      1. Textures
      2. Texture Options
      3. Texturing a 3D Object
      4. Toggling State
      5. Multiple Textures
      6. Lighting
      7. Lighting Models
      8. Texture and Lighting Together
      9. Summary
    12. Chapter 4: Increasing Realism
      1. Setup
      2. Lighting Revisited
      3. Fog
      4. Shadows
      5. Depth Buffer
      6. Blending
      7. Reflection and Refraction
      8. Putting it All Together
      9. Summary
    13. Chapter 5: Physics
      1. Background
      2. Forces Acting Upon Us
      3. Code Setup
      4. Storing Information
      5. Gravity
      6. Velocity in Three Dimensions
      7. Intercollisions
      8. Projectiles
      9. Potential Energy
      10. Summary
    14. Chapter 6: Fractals, Height Maps, and Particle Systems
      1. Painting Directly with the GPU
      2. Fractals
      3. Generation of Fractals
      4. Rendering a Grid Mesh with One TRIANGLE_STRIP Call
      5. Height Maps
      6. Terrain
      7. Particle Systems
      8. Summary
    15. Chapter 7: Three.js Framework
      1. Background
      2. Setup
      3. Basic Usage
      4. Updating Objects
      5. Falling Back to the 2D Canvas Context
      6. Shaders
      7. Revisiting Earlier Book Code
      8. Advanced Usage
      9. Summary
    16. Chapter 8: Productivity Tools
      1. Frameworks
      2. Meshes
      3. Shaders
      4. Textures
      5. Physics Engines
      6. Summary
    17. Chapter 9: Debugging and Performance
      1. Debugging
      2. Performance
      3. Summary
    18. Chapter 10: Effects, Tips, and Tricks
      1. Effects
      2. Antialiasing
      3. Nonphotorealistic Rendering
      4. Framebuffers
      5. Picking Objects
      6. Shadow Map Implementation
      7. Summary
    19. Afterword: The Future of WebGL
      1. Support
      2. Adoption
      3. Active Development
      4. The Final Word
    20. Appendix A: Essential HTML5 and JavaScript
      1. Essential HTML5
      2. Essential JavaScript
      3. jQuery
    21. Appendix B: Graphics Refresher
      1. Pixels
      2. Primitives
      3. Colors
      4. Coordinate Systems
      5. Transforms
      6. Math
    22. Appendix C: WebGL Spec. Odds and Ends
      1. WebGLContextAttributes
      2. Texture Properties
      3. Cube Map Targets
      4. Framebuffer and RenderBuffer Targets and Attachments
    23. Appendix D: Additional Resources
      1. Companion Website
      2. Topics
    24. Index