vinyl-gl-0.2.1: Utilities for working with OpenGL's GLSL shading language and vinyl records.

Safe HaskellNone
LanguageHaskell2010

Graphics.VinylGL.Uniforms

Description

Tools for binding vinyl records to GLSL program uniform parameters. The most common usage is to use the setUniforms function to set each field of a PlainRec to the GLSL uniform parameter with the same name. This verifies that each field of the record corresponds to a uniform parameter of the given shader program, and that the types all agree.

Synopsis

Documentation

setAllUniforms :: forall ts. UniformFields (PlainFieldRec ts) => ShaderProgram -> PlainFieldRec ts -> IO () Source

Set GLSL uniform parameters from a PlainRec. A check is performed to verify that all uniforms used by a program are represented by the record type. In other words, the record is a superset of the parameters used by the program.

setSomeUniforms :: forall ts. UniformFields (PlainFieldRec ts) => ShaderProgram -> PlainFieldRec ts -> IO () Source

Set GLSL uniform parameters from those fields of a PlainRec whose names correspond to uniform parameters used by a program.

setUniforms :: forall ts. UniformFields (PlainFieldRec ts) => ShaderProgram -> PlainFieldRec ts -> IO () Source

Set GLSL uniform parameters from a PlainRec representing a subset of all uniform parameters used by a program.

class HasFieldGLTypes a where Source

Provide the VariableType of each field in a Rec. The list of types has the same order as the fields of the Rec.

type UniformFields a = (HasFieldNames a, HasFieldGLTypes a, SetUniformFields a) Source

Constraint synonym for PlainFieldRecs that carry valid GLSL uniforms.

class SetUniformFields a Source

Zips up lists of UniformLocations and a PlainFieldRec setting uniform parameters using the record fields.

Minimal complete definition

setUniformFields