src/twgl.js
function setDefaults(newDefaults) {
  helper.copyExistingProperties(newDefaults, defaults);
  attributes.setAttributeDefaults_(newDefaults);  // eslint-disable-line
  textures.setTextureDefaults_(newDefaults);  // eslint-disable-line
}
function setDefaults(newDefaults) {
  helper.copyExistingProperties(newDefaults, defaults);
  attributes.setAttributeDefaults_(newDefaults);  // eslint-disable-line
  textures.setTextureDefaults_(newDefaults);  // eslint-disable-line
}
function setDefaults ( newDefaults ) { helper . copyExistingProperties ( newDefaults , defaults ) ; attributes . setAttributeDefaults_ ( newDefaults ) ; // eslint-disable-line textures . setTextureDefaults_ ( newDefaults ) ; // eslint-disable-line }
Various default settings for twgl.

Note: You can call this any number of times. Example:

twgl.setDefaults({ textureColor: [1, 0, 0, 1] });
twgl.setDefaults({ attribPrefix: 'a_' });

is equivalent to

twgl.setDefaults({
textureColor: [1, 0, 0, 1],
attribPrefix: 'a_',
});

@typedef {Object} Defaults
@property {string} [attribPrefix] The prefix to stick on attributes

When writing shaders I prefer to name attributes with `a_`, uniforms with `u_` and varyings with `v_`
as it makes it clear where they came from. But, when building geometry I prefer using unprefixed names.

In otherwords I'll create arrays of geometry like this

const arrays = {
position: ...
normal: ...
texcoord: ...
};

But need those mapped to attributes and my attributes start with `a_`.

Default: `""`

@property {number[]} [textureColor] Array of 4 values in the range 0 to 1

The default texture color is used when loading textures from
urls. Because the URL will be loaded async we'd like to be
able to use the texture immediately. By putting a 1x1 pixel
color in the texture we can start using the texture before
the URL has loaded.

Default: `[0.5, 0.75, 1, 1]`

@property {string} [crossOrigin]

If not undefined sets the crossOrigin attribute on images
that twgl creates when downloading images for textures.

Also see {@link module:twgl.TextureOptions}.

@property {bool} [addExtensionsToContext]

If true, then, when twgl will try to add any supported WebGL extensions
directly to the context under their normal GL names. For example
if ANGLE_instances_arrays exists then twgl would enable it,
add the functions `vertexAttribDivisor`, `drawArraysInstanced`,
`drawElementsInstanced`, and the constant `VERTEX_ATTRIB_ARRAY_DIVISOR`
to the `WebGLRenderingContext`.

@memberOf module:twgl
 
Sets various defaults for twgl.

In the interest of terseness which is kind of the point
of twgl I've integrated a few of the older functions here

@param {module:twgl.Defaults} newDefaults The default settings.
@memberOf module:twgl
Various default settings for twgl .