the current WebGL rendering context
a string containing the GLSL source code to set
a string containing the GLSL source code to set
Optionalprecision: stringfloat precision ('lowp', 'mediump' or 'highp').
// create a basic shader
let myShader = new me.GLShader(
// WebGL rendering context
gl,
// vertex shader
[
"void main() {",
" gl_Position = doMathToMakeClipspaceCoordinates;",
"}"
].join("\n"),
// fragment shader
[
"void main() {",
" gl_FragColor = doMathToMakeAColor;",
"}"
].join("\n")
)
// use the shader
myShader.bind();
the location attributes of the shader
the fragment shader source code
the active gl rendering context
a reference to the shader program (once compiled)
the uniforms of the shader
the vertex shader source code
Installs this shader program as part of current rendering state
destroy this shader objects resources (program, attributes, uniforms)
returns the location of an attribute variable in this shader program
the name of the attribute variable whose location to get.
number indicating the location of the variable name if found. Returns -1 otherwise
Set the uniform to the given value
the uniform name
the value to assign to that uniform
activate the given vertex attribute for this shader
the current WebGL rendering context
an array of vertex attributes
the size of a single vertex in bytes
a base GL Shader object