WebGLRenderingContext.drawingBufferHeight

WebGLRenderingContext.drawingBufferHeight 只读属性,指示当前绘图缓冲区的实际高度。它应当匹配与绘图上下文相关联的 <canvas> 元素的高度属性, 如果实现未能提供所要求的高度,其值将有所不同。

语法

gl.drawingBufferHeight;

示例

指定 <canvas> 元素:

<canvas id="canvas"></canvas>

你可以通过下面几行代码来获取绘图缓冲区的高度:

var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");
gl.drawingBufferHeight; // 150

规范

Specification Status Comment
WebGL 1.0
WebGLRenderingContext.drawingBufferHeight
Recommendation 初始定义

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
drawingBufferHeightChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Firefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8Samsung Internet Android Full support Yes

Legend

Full support  
Full support

相关链接