APPENDIX C

image

WebGL Spec. Odds and Ends

This appendix contains some parts of the specification that we mentioned but did not fully cover and are listed here for reference.

WebGLContextAttributes

When we obtain our WebGL context, we can optionally pass it an object containing some or all of the following properties:

dictionary WebGLContextAttributes {

    boolean alpha = true;

    boolean depth = true;

    boolean stencil = false;

    boolean antialias = true;

    boolean premultipliedAlpha = true;

    boolean preserveDrawingBuffer = false;

};

We showed how to preserve the drawing buffer in a Chapter 5 projectile example using this:

gl = canvas.getContext("webgl", ...

Get Beginning WebGL for HTML5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.