graphics.undefineEffect()

Type Function
Library graphics.*
Return value none
Revision Release 2022.3683
Keywords shaders, effects, graphics
See also Custom Shader Effects (guide)
Filters / Generators / Composites (guide)

Overview

This function allows you to undefine/release custom shader effects.

Syntax

graphics.undefineEffect( effect )
effect (required)

String. The full name of the custom shader effect, as in "<category>.<group>.<name>".

Example

local kernel = {}
kernel.category = "filter"
kernel.name = "myBrighten"

kernel.fragment =
[[
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord )
{
    P_COLOR float brightness = 0.5;
    P_COLOR vec4 texColor = texture2D( CoronaSampler0, texCoord );

    // Pre-multiply the alpha to brightness
    brightness = brightness * texColor.a;

    // Add the brightness
    texColor.rgb += brightness;

    // Modulate by the display object's combined alpha/tint
    return CoronaColorScale( result );
}
]]

graphics.defineEffect( kernel )

-- When the effect is no longer needed, it can be undefined
graphics.undefineEffect( "filter.custom.myBrighten" )