WebGLRenderingContext.drawingBufferHeight
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
WebGLRenderingContext.drawingBufferHeight
只读属性,指示当前绘图缓冲区的实际高度。它应当匹配与绘图上下文相关联的 <canvas>
元素的高度属性,如果实现未能提供所要求的高度,其值将有所不同。
语法
gl.drawingBufferHeight;
示例
指定 <canvas>
元素:
html
<canvas id="canvas"></canvas>
你可以通过下面几行代码来获取绘图缓冲区的高度:
js
var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");
gl.drawingBufferHeight; // 150
规范
Specification |
---|
WebGL Specification # DOM-WebGLRenderingContext-drawingBufferHeight |
浏览器兼容性
BCD tables only load in the browser