The Program is rendering the graphical elements of a Buffer with the corresponding shader and assigned Textures.
The shader code can be modified at runtime by formulas or also by glsl code-injection and custom uniforms.
It supports different modes for color blending, stencil masks or depth-buffer.
Constructor
Variables
colorEnabled:Bool = true
To enable or disable color rendering, e.g. disable to only render into the stencil-buffer by drawing a mask.
blendSeparate:Bool = false
Use a separate blend-function for the alpha channel if the blendmode is enabled.
blendFuncSeparate:Bool = false
Separate blend-function for the alpha channel if blendSeparate is true.
mask:Mask = Mask.OFF
To use the stencil-buffer for masking or to draw into it to use it afterwards by another program.
autoUpdate:Bool = true
Enable automatic shader generation for functioncalls what set, add or remove textures (also for snapToPixel, discardAtAlpha, shadercode-injection, formula and precision changes)
Methods
inlineisIn(display:Display):Bool
Returns true is this program is inside the RenderList of a Display instance.
Parameters:
| display | Display instance | 
|---|
addToDisplay(display:Display, ?atProgram:Program, addBefore:Bool = false):Void
Adds this program to the RenderList of a Display instance.
Can be also used to change the order (relative to another program) if it is already added.
Parameters:
| display | Display instance | 
|---|---|
| atProgram | (optional) to add or move before or after another program in the RenderList (by default at start or at end) | 
| addBefore | (optional) if 'true' it's added before another program or at start of the Renderlist (by default it's added after atProgram or at end) | 
removeFromDisplay(display:Display):Void
setColorFormula(formula:String = "", ?varDefaults:StringMap<Color>, ?autoUpdate:Bool):Void
Set a formula to combine the colors of @texUnits together with the @color attributes of an element.
Parameters:
| formula | a String what contains the color formula | 
|---|---|
| varDefaults | defines the default colors by a Map with the  | 
| autoUpdate | set it to  | 
injectIntoVertexShader(glslCode:String = "", uTimeUniformEnabled:Bool = false, ?uniformFloats:Array<UniformFloat>, ?autoUpdate:Bool):Void
Inject custom glsl code into the vertexshader of a program.
Parameters:
| glslCode | a String what contains the glsl code | 
|---|---|
| uTimeUniformEnabled | if  | 
| uniformFloats | an Array of custom  | 
| autoUpdate | set it to  | 
injectIntoFragmentShader(glslCode:String = "", uTimeUniformEnabled:Bool = false, ?uniformFloats:Array<UniformFloat>, ?autoUpdate:Bool):Void
Inject custom glsl code into the fragmentshader of a program.
Parameters:
| glslCode | a String what contains the glsl code | 
|---|---|
| uTimeUniformEnabled | if  | 
| uniformFloats | an Array of custom  | 
| autoUpdate | set it to  | 
setFormula(name:String, newFormula:String, ?autoUpdate:Bool):Void
Define formulas to change the calculation for element attributes at runtime
Parameters:
| name | a String with the attribute identifier | 
|---|---|
| newFormula | a String what contains the formula | 
| autoUpdate | set it to  | 
setFragmentFloatPrecision(?precision:String, ?autoUpdate:Bool):Void
Set the float precision for the fragmentshader
Parameters:
| precision | a String what can be "low", "medium" or "high" | 
|---|---|
| autoUpdate | set it to  | 
setFragmentIntPrecision(?precision:String, ?autoUpdate:Bool):Void
Set the integer precision for the fragmentshader
Parameters:
| precision | a String what can be "low", "medium" or "high" | 
|---|---|
| autoUpdate | set it to  | 
setFragmentSamplerPrecision(?precision:String, ?autoUpdate:Bool):Void
Set the sampler2D precision for the fragmentshader
Parameters:
| precision | a String what can be "low", "medium" or "high" | 
|---|---|
| autoUpdate | set it to  | 
setVertexFloatPrecision(?precision:String, ?autoUpdate:Bool):Void
Set the float precision for the vertexShader
Parameters:
| precision | a String what can be "low", "medium" or "high" | 
|---|---|
| autoUpdate | set it to  | 
setVertexIntPrecision(?precision:String, ?autoUpdate:Bool):Void
Set the integer precision for the vertexShader
Parameters:
| precision | a String what can be "low", "medium" or "high" | 
|---|---|
| autoUpdate | set it to  | 
setVertexSamplerPrecision(?precision:String, ?autoUpdate:Bool):Void
Set the sampler2D precision for the vertexShader
Parameters:
| precision | a String what can be "low", "medium" or "high" | 
|---|---|
| autoUpdate | set it to  | 
snapToPixel(?pixelDivisor:Float, ?autoUpdate:Bool):Void
Activate pixelsnapping
Parameters:
| pixelDivisor | a Float multiplicator at which snapping is to take place, set it to  | 
|---|---|
| autoUpdate | set it to  | 
discardAtAlpha(?atAlphaValue:Float, ?autoUpdate:Bool):Void
From which alpha value the pixels are discarded.
Parameters:
| atAlphaValue | a Float value for the alpha limit ( | 
|---|---|
| autoUpdate | set it to  | 
setTexture(texture:Texture, ?identifier:String, ?autoUpdate:Bool):Void
Assign a Texture instance to a texture-layer (by identifier).
Parameters:
| texture | Texture instance | 
|---|---|
| identifier | texture-layer identifier (optional) - without it, the first available or "default" is used | 
| autoUpdate | set it to  | 
setMultiTexture(textureUnits:Array<Texture>, ?identifier:String, ?autoUpdate:Bool):Void
Assign multiple Texture instances to a texture-layer (by identifier). Can switch between them by using an @texUnit("identifier") integer attribute inside the Element.
Parameters:
| textureUnits | an Array of Texture instances | 
|---|---|
| identifier | texture-layer identifier (optional) - without it, the first available or "default" is used | 
| autoUpdate | set it to  | 
addTexture(texture:Texture, ?identifier:String, ?autoUpdate:Bool):Void
Adds a Texture to a texture-layer (by identifier). Can switch between them by using an @texUnit("identifier") integer attribute inside the Element.
Parameters:
| texture | Texture instance | 
|---|---|
| identifier | texture-layer identifier (optional) - without it, the first available or "default" is used | 
| autoUpdate | set it to  | 
removeTexture(texture:Texture, ?identifier:String, ?autoUpdate:Bool):Void
Removes a Texture from a texture-layer (by identifier) or from all layers where it is used.
Parameters:
| texture | Texture instance | 
|---|---|
| identifier | texture-layer identifier (optional) | 
| autoUpdate | set it to  | 
removeAllTexture(?identifier:String, ?autoUpdate:Bool):Void
Removes all Textures of a texture-layer (by identifier) or removes all textures from all layers.
Parameters:
| identifier | texture-layer identifier (optional) | 
|---|---|
| autoUpdate | set it to  | 
hasTexture(texture:Texture, ?identifier:String):Bool
Returns true if the program or a specific texture-layer contains a texture.
Parameters:
| texture | Texture instance | 
|---|---|
| identifier | texture-layer identifier, if set to  | 
setActiveTextureGlIndex(texture:Texture, index:Int):Void
To set the opengl index manually if using multiple textures.
Parameters:
| texture | Texture instance | 
|---|---|
| index | Integer value for the index (starts by  |