@@ -10,21 +10,21 @@ import * as constants from '../core/constants';
1010import './p5.Texture' ;
1111
1212/**
13- * Loads a custom shader from the provided vertex and fragment
14- * shader paths. The shader files are loaded asynchronously in the
13+ * Creates a new <a href="#/p5.Shader">p5.Shader</a> object
14+ * from the provided vertex and fragment shader files.
15+ *
16+ * The shader files are loaded asynchronously in the
1517 * background, so this method should be used in <a href="#/p5/preload">preload()</a>.
1618 *
17- * For now, there are three main types of shaders. p5 will automatically
18- * supply appropriate vertices, normals, colors, and lighting attributes
19- * if the parameters defined in the shader match the names.
19+ * Note, shaders can only be used in WEBGL mode.
2020 *
2121 * @method loadShader
2222 * @param {String } vertFilename path to file containing vertex shader
2323 * source code
2424 * @param {String } fragFilename path to file containing fragment shader
2525 * source code
2626 * @param {function } [callback] callback to be executed after loadShader
27- * completes. On success, the Shader object is passed as the first argument.
27+ * completes. On success, the p5. Shader object is passed as the first argument.
2828 * @param {function } [errorCallback] callback to be executed when an error
2929 * occurs inside loadShader. On error, the error is passed as the first
3030 * argument.
@@ -109,6 +109,11 @@ p5.prototype.loadShader = function(
109109} ;
110110
111111/**
112+ * Creates a new <a href="#/p5.Shader">p5.Shader</a> object
113+ * from the provided vertex and fragment shader code.
114+ *
115+ * Note, shaders can only be used in WEBGL mode.
116+ *
112117 * @method createShader
113118 * @param {String } vertSrc source code for the vertex shader
114119 * @param {String } fragSrc source code for the fragment shader
@@ -177,15 +182,22 @@ p5.prototype.createShader = function(vertSrc, fragSrc) {
177182} ;
178183
179184/**
180- * The <a href="#/p5/shader">shader()</a> function lets the user provide a custom shader
181- * to fill in shapes in WEBGL mode. Users can create their
182- * own shaders by loading vertex and fragment shaders with
183- * <a href="#/p5/loadShader">loadShader()</a>.
185+ * Sets the <a href="#/p5.Shader">p5.Shader</a> object to
186+ * be used to render subsequent shapes.
187+ *
188+ * Custom shaders can be created using the
189+ * <a href="#/p5/createShader">createShader()</a> and
190+ * <a href="#/p5/loadShader">loadShader()</a> functions.
191+ *
192+ * Use <a href="#/p5/resetShader">resetShader()</a> to
193+ * restore the default shaders.
194+ *
195+ * Note, shaders can only be used in WEBGL mode.
184196 *
185197 * @method shader
186198 * @chainable
187- * @param {p5.Shader } [s] the desired <a href="#/p5.Shader">p5.Shader</a> to use for rendering
188- * shapes.
199+ * @param {p5.Shader } s the <a href="#/p5.Shader">p5.Shader</a> object
200+ * to use for rendering shapes.
189201 *
190202 * @example
191203 * <div modernizr='webgl'>
@@ -268,9 +280,9 @@ p5.prototype.shader = function(s) {
268280} ;
269281
270282/**
271- * This function restores the default shaders in WEBGL mode . Code that runs
272- * after resetShader() will not be affected by previously defined
273- * shaders. Should be run after <a href="#/p5/shader">shader()</a>.
283+ * Restores the default shaders. Code that runs after resetShader()
284+ * will not be affected by the shader previously set by
285+ * <a href="#/p5/shader">shader()</a>
274286 *
275287 * @method resetShader
276288 * @chainable
0 commit comments