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.
Returns:
- Type
- Quad
Members
-
colorBuffer :WebGLBuffer
-
The vertex color buffer to push to the GPU.
Type:
- WebGLBuffer
-
colors :Float32Array
-
An array of rgba values that represent vertex colors.
Type:
- Float32Array
-
height :number
-
The height of the Quad.
Type:
- number
-
uvBuffer :WebGLBuffer
-
The uv buffer to push to the GPU.
Type:
- WebGLBuffer
-
uvs :Float32Array
-
An array of u, v texture coordinates.
Type:
- Float32Array
-
vertexBuffer :WebGLBuffer
-
The vertex buffer to push to the GPU.
Type:
- WebGLBuffer
-
vertices :Float32Array
-
An array of x, y coordinates that represent the Quad's vertices.
Type:
- Float32Array
-
width :number
-
The width of the Quad.
Type:
- number
Methods
-
apply()
-
Applies width and height changes to the Quad's geometry. This must be called after width or height has been changed.
-
clearBuffers()
-
Called when the WebGLContext has been lost.
-
draw(ctx)
-
Makes the actual draw call.
Parameters:
Name Type Description ctxWebGLContext The context to draw on. -
prepareBuffers(ctx)
-
Creates buffers and binds data only when necessary.
Parameters:
Name Type Description ctxWebGLContext The context to prepare for. -
pushBuffers(ctx, shader)
-
Parameters:
Name Type Description ctxWebGLContext The context to push the buffers to. shaderShader The shader to grab pointers from.