Class: Program

Palette. Program

Abstraction of program references to allow easy manipulation.

new Program(gl, vs, fs)

The Program object, generated from linked pairs of vs-fs combinations.
Parameters:
Name Type Description
gl WebGLRenderingContext The context the shaders of this program will belong to and be compiled by.
vs Palette.Shader The Palette.Shader acting as the vertex shader for this program.
fs Palette.Shader The Palette.Shader acting as the fragment shader for this program.
Author:
  • FelixMcFelix (Kyle S.)
Source:

Members

<protected, readonly> context :WebGLRenderingContext

The program's attached context.
Type:
  • WebGLRenderingContext
Source:

<protected, readonly> fs :Palette.Shader

The program's attached fragment shader.
Type:
Source:

<protected, readonly> program :WebGLProgram

The program as seen by WebGL.
Type:
  • WebGLProgram
Source:

<protected, readonly> vs :Palette.Shader

The program's attached vertex shader.
Type:
Source:

Methods

draw(verts, conf1, conf2)

Draw a set of vertices with this program, with optional configuration. Configurations passed here do not overwrite the cached object. This method is accessed when Palette.Manager#draw is called.
Parameters:
Name Type Argument Description
verts Float32Array Vertex list to pass to the GPU.
conf1 object <optional>
A set of attributes to pass down to the fragment shader.
conf2 object <optional>
A set of attributes to pass down to the vertex shader.
Source:

restoreDefaultConfig(mode)

Restore a program's object config for either shader or both.
Parameters:
Name Type Description
mode int The identifier for which config object to revert. Supports Palette.Program.VS_MODE, Palette.Program.FS_MODE, Palette.Program.BOTH_MODE.
Source:

setConfig(mode, conf)

Set a program's object config for either shader or both with a given config object. Object properties not in the supplied object will not overwrite the program state.
Parameters:
Name Type Description
mode int The identifier for which config object to set. Supports Palette.Program.VS_MODE, Palette.Program.FS_MODE, Palette.Program.BOTH_MODE.
conf object The config object to inject into the program state.
Source:

setDrawMode(mode)

Set a program's draw mode.
Parameters:
Name Type Description
mode int The gl code for drawing mode. Supports Palette.Program.POINTS, .LINES, .LINE_LOOP, .LINE_STRIP, .TRIANGLES, .TRIANGLE_STRIP, .TRIANGLE_FAN.
Source: