GLUtil-0.9.0.1: Miscellaneous OpenGL utilities.

Safe HaskellNone
LanguageHaskell98

Graphics.GLUtil.Shaders

Description

Utilities for working with fragment and vertex shader programs.

Synopsis

Documentation

loadShader :: ShaderType -> FilePath -> IO Shader Source

Load a shader program from a file.

loadShaderBS :: FilePath -> ShaderType -> ByteString -> IO Shader Source

loadShaderBS fileName shaderType src loads a shader from source code, src. The file name is used only for error reporting.

linkShaderProgram :: [Shader] -> IO Program Source

Link shaders into a Program.

linkShaderProgramWith :: [Shader] -> (Program -> IO ()) -> IO Program Source

Link shaders into a Program with the given action performed after attaching shaders, but before linking the program. This is most commonly used to set the bindFragDataLocation state variable.

namedUniform :: Uniform a => String -> StateVar a Source

Work with a named uniform shader parameter. Note that this looks up the variable name on each access, so uniform parameters that will be accessed frequently should instead be resolved to a UniformLocation.

uniformVec :: UniformLocation -> SettableStateVar [GLfloat] Source

Set a UniformLocation from a list representation of a low-dimensional vector of GLfloats. Only 2, 3, and 4 dimensional vectors are supported.

uniformMat :: UniformLocation -> SettableStateVar [[GLfloat]] Source

Set a uniform shader location from a nested list matrix representation. Only 3x3 and 4x4 matrices are supported.

namedUniformMat :: String -> SettableStateVar [[GLfloat]] Source

Set a named uniform shader parameter from a nested list matrix representation. Only 3x3 and 4x4 matrices are supported.

uniformGLMat4 :: UniformLocation -> SettableStateVar (GLmatrix GLfloat) Source

Set a uniform shader location with a 4x4 GLmatrix.