--- title: WebGLRenderingContext.getShaderSource() slug: Web/API/WebGLRenderingContext/getShaderSource translation_of: Web/API/WebGLRenderingContext/getShaderSource ---
WebGLRenderingContext.getShaderSource()
方法以{{domxref("DOMString")}}的形式返回了一个{{domxref("WebGLShader")}}的源码。DOMString gl.getShaderSource(shader);
一个包含了指定着色器的源码的 {{domxref("DOMString")}} 。
var shader = gl.createShader(gl.VERTEX_SHADER); gl.shaderSource(shader, originalSource); var source = gl.getShaderSource(shader);
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.9", "getShaderSource")}} | {{Spec2('WebGL')}} | 初始定义 |
{{SpecName('OpenGL ES 2.0', "glGetShaderSource.xml", "glGetShaderSource")}} | {{Spec2('OpenGL ES 2.0')}} | (类似) OpenGL API的手册 |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.WebGLRenderingContext.getShaderSource")}}