WebGLUniformLocation

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.

* Some parts of this feature may have varying levels of support.

WebGLUniformLocation 接口是 WebGL API 的一部分,在一个着色器程序中表示一个统一变量的位置。

说明

WebGLUniformLocation 对象未定义任何属于自己并能直接访问其内容的方法和属性。在使用 WebGLUniformLocation 对象时,WebGLRenderingContext 的方法是有用的:

示例

获取一个统一位置

js
var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");

var location = gl.getUniformLocation(WebGLProgram, "uniformName");

规范

Specification
WebGL Specification
# 5.10

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
WebGLUniformLocation
Available in workers
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

参见