WebGLRenderingContext.shaderSource()

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.

La méthode WebGLRenderingContext.shaderSource() de l'API WebGL définit le code source d'un WebGLShader.

Syntaxe

js
void gl.shaderSource(shader, source);

Parameters

shader

Un objet WebGLShader dans lequel définir le code source.

source

Une DOMString contenant le code source GLSL à définir.

Valeur retournée

Aucune.

Exemple

js
var shader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(shader, originalSource);

var source = gl.getShaderSource(shader);

Spécifications

Specification
WebGL Specification
# 5.14.9

Compatibilité des navigateurs

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
shaderSource

Legend

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

Full support
Full support

Voir aussi