Class: Quad

Quad

Quad

new Quad() → {Quad}

The Quad class represents a simple quad geometry. It includes a vertex, uv, and vertex color buffer. Quads are drawn using the triangle strip primitive.
Author:
  • thegoldenmule
Source:
Returns:
Type
Quad

Members

colorBuffer :WebGLBuffer

The vertex color buffer to push to the GPU.
Type:
  • WebGLBuffer
Source:

colors :Float32Array

An array of rgba values that represent vertex colors.
Type:
  • Float32Array
Source:

height :number

The height of the Quad.
Type:
  • number
Source:

uvBuffer :WebGLBuffer

The uv buffer to push to the GPU.
Type:
  • WebGLBuffer
Source:

uvs :Float32Array

An array of u, v texture coordinates.
Type:
  • Float32Array
Source:

vertexBuffer :WebGLBuffer

The vertex buffer to push to the GPU.
Type:
  • WebGLBuffer
Source:

vertices :Float32Array

An array of x, y coordinates that represent the Quad's vertices.
Type:
  • Float32Array
Source:

width :number

The width of the Quad.
Type:
  • number
Source:

Methods

apply()

Applies width and height changes to the Quad's geometry. This must be called after width or height has been changed.
Source:

clearBuffers()

Called when the WebGLContext has been lost.
Source:

draw(ctx)

Makes the actual draw call.
Parameters:
Name Type Description
ctx WebGLContext The context to draw on.
Source:

prepareBuffers(ctx)

Creates buffers and binds data only when necessary.
Parameters:
Name Type Description
ctx WebGLContext The context to prepare for.
Source:

pushBuffers(ctx, shader)

Parameters:
Name Type Description
ctx WebGLContext The context to push the buffers to.
shader Shader The shader to grab pointers from.
Source: