GLUtil-0.6.4: Miscellaneous OpenGL utilities.

Safe HaskellNone

Graphics.GLUtil.Shaders

Description

Utilities for working with fragment and vertex shader programs.

Synopsis

Documentation

loadShader :: Shader s => FilePath -> IO sSource

Load a shader program from a file.

loadGeoShader :: FilePath -> IO GeometryShaderSource

Specialized loading for geometry shaders that are not yet fully supported by the Haskell OpenGL package.

linkShaderProgram :: [VertexShader] -> [FragmentShader] -> IO ProgramSource

Link vertex and fragment shaders into a Program.

linkShaderProgramWith :: [VertexShader] -> [FragmentShader] -> (Program -> IO ()) -> IO ProgramSource

Link vertex and fragment shaders into a Program. The supplied IO action is run after attaching shader objects to the new program, but before linking. This supports the use of bindFragDataLocation to map fragment shader outputs.

linkGeoProgram :: [VertexShader] -> [GeometryShader] -> [FragmentShader] -> IO ProgramSource

Link vertex, geometry, and fragment shaders into a Program.

linkGeoProgramWith :: [VertexShader] -> [GeometryShader] -> [FragmentShader] -> (Program -> IO ()) -> IO ProgramSource

Link vertex, geometry, and fragment shaders into a Program. The supplied IO action is run after attaching shader objects to the new program, but before linking. This supports the use of bindFragDataLocation to map fragment shader outputs.

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

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.