We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

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 初始定义

浏览器兼容性

No compatibility data found. Please contribute data for "api/WebGLRenderingContext" (depth: WebGLRenderingContext.drawingBufferHeight) to the MDN compatibility data repository.

另见

文档标签和贡献者

此页面的贡献者: luojia, LiebeU
最后编辑者: luojia,