Class: DrawCall

DrawCall()

new DrawCall()

A DrawCall represents the program and values of associated attributes, uniforms and textures for a single draw call.
Properties:
Name Type Description
gl WebGLRenderingContext The WebGL context.
currentProgram Program The program to use for this draw call.
currentVertexArray VertexArray Vertex array to use for this draw call.
currentTransformFeedback TransformFeedback Transform feedback to use for this draw call.
uniformBuffers Array Ordered list of active uniform buffers.
uniformBlockNames Array Ordered list of uniform block names.
uniformBlockCount Number Number of active uniform blocks for this draw call.
uniformIndices Object Map of uniform names to indices in the uniform arrays.
uniformNames Array Ordered list of uniform names.
uniformValue Array Ordered list of uniform values.
uniformCount number The number of active uniforms for this draw call.
textures Array Array of active textures.
textureCount number The number of active textures for this draw call.
appState Object Tracked GL state.
numElements GLsizei The number of element to draw.
numInstances GLsizei The number of instances to draw.
Source:

Methods

draw() → {DrawCall}

Draw based on current state.
Source:
Returns:
The DrawCall object.
Type
DrawCall

drawRanges(…counts) → {DrawCall}

Ranges in the vertex array to draw. Multiple arguments can be provided to set up a multi-draw. Note that after this method is called, draw counts will no longer automatically be pulled from the VertexArray.
Parameters:
Name Type Attributes Description
counts Array <repeatable>
Variable number of 2 or 3 element arrays, each containing:
  • (Number) Number of elements to skip at the start of the array.
  • (Number) Number of elements to draw.
  • (Number - optional) Number of instances to draw of the given range.
Source:
Returns:
The DrawCall object.
Type
DrawCall

primitive(primitive) → {DrawCall}

Set the current draw primitive for this draw call.
Parameters:
Name Type Description
primitive GLenum Primitive to draw.
Source:
Returns:
The DrawCall object.
Type
DrawCall

texture(name, texture) → {DrawCall}

Set texture to bind to a sampler uniform.
Parameters:
Name Type Description
name string Sampler uniform name.
texture Texture | Cubemap Texture or Cubemap to bind.
Source:
Returns:
The DrawCall object.
Type
DrawCall

transformFeedback(transformFeedback) → {DrawCall}

Set the current TransformFeedback object for draw.
Parameters:
Name Type Description
transformFeedback TransformFeedback Transform Feedback to set.
Source:
Returns:
The DrawCall object.
Type
DrawCall

uniform(name, value) → {DrawCall}

Set the value for a uniform. Array uniforms are supported by using appending "[0]" to the array name and passing a flat array with all required values.
Parameters:
Name Type Description
name string Uniform name.
value any Uniform value.
Source:
Returns:
The DrawCall object.
Type
DrawCall

uniformBlock(name, buffer) → {DrawCall}

Set uniform buffer to bind to a uniform block.
Parameters:
Name Type Description
name string Uniform block name.
buffer UniformBuffer Uniform buffer to bind.
Source:
Returns:
The DrawCall object.
Type
DrawCall