linsyking/elm-regl/9.2.0

NOTE: the latest version is 10.0.0

Renamed to elm-messenger/elm-regl. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as linsyking/elm-regl still install under that name. 5 versions of 15 come from the new location (see their notes).

REGL.Program

Custom REGL Program

Users could define their own custom REGL program using this module. REGL programs could be used as a renderable generator, effect, or compositor.

Program Value

= DynamicValue String
| StaticValue Value
| DynamicTextureValue String

A value that can be either a static value or a dynamic value.

Program Construction

type alias REGLProgram =
{ frag : String
, vert : String
, attributes : Maybe (List ( String, ProgValue ))
, uniforms : Maybe (List ( String, ProgValue ))
, elements : Maybe ProgValue
, primitive : Maybe ProgValue
, count : Maybe ProgValue
}

A custom program that can be used with REGL.

encodeProgram : REGLProgram -> Value

Encode a custom program to an object.

Usually users could use the following functions to construct a custom program by only providing the fragment shader and uniforms:

makeEffectSimple : String -> List ( String, ProgValue ) -> REGLProgram

Make a custom effect program simply.

In the fragment shader, use texture2D(texture, vuv) to sample the texture.

You could also use vec2 view to get the size of virtual canvas.

makeCompositorSimple : String -> List ( String, ProgValue ) -> REGLProgram

Make a custom composite program simply.

t1 and t2 are the names of the texture uniforms in the program.

If more customization is needed, users could use the following functions:

makeCompositorProgram : String -> String -> REGLProgram -> REGLProgram

Make a custom composite program.

src and dst are the names of the texture uniforms in the program.

makeEffectProgram : String -> REGLProgram -> REGLProgram

Make a custom effect program.

texname is the name of the texture uniform in the program.