官术网_书友最值得收藏!

WebGL and canvas contexts

WebGL is a rendering context for drawing to the HTML5 element, and is an alternative to the 2D rendering context. Often, when someone mentions the canvas, they are referring to the 2D rendering context, which is accessed by calling getContext and passing in the string 2d. Both contexts are methods of rendering to the HTML5 canvas element. A context is a type of API for immediate mode rendering. Two different WebGL contexts can be requested, both of which provide access to different versions of the WebGL API. These contexts are webgl and webgl2. In the following examples, I will be using the webgl context and will be using the WebGL 1.0 API. There is also a rarely used context for rendering a bitmap to the canvas that we can access by passing in bitmaprenderer as a string value.

I want to point out that the term canvas is sometimes used to refer to the 2D canvas context and sometimes used to refer to the immediate mode rendering HTML5 canvas element. When I refer to canvas in this book without mentioning the 2D context, I am referring to the HTML5 canvas element.

In the next section, I will introduce you to shaders and the GLSL shader language.

主站蜘蛛池模板: 蒙山县| 宁国市| 双柏县| 陆河县| 杭锦旗| 九龙县| 从化市| 桐乡市| 昌吉市| 武宁县| 商洛市| 七台河市| 永靖县| 五大连池市| 前郭尔| 巴彦淖尔市| 馆陶县| 和林格尔县| 安塞县| 金寨县| 库伦旗| 邢台县| 枣强县| 浦城县| 来凤县| 菏泽市| 丽水市| 黔江区| 颍上县| 慈溪市| 朔州市| 平安县| 香格里拉县| 安康市| 昌黎县| 册亨县| 大庆市| 襄垣县| 清镇市| 花垣县| 乳源|