GLUtil-0.6.6: Miscellaneous OpenGL utilities.

Safe HaskellNone

Graphics.GLUtil.ShaderProgram

Description

Convenience interface for working with GLSL shader programs. Provides an interface for setting attributes and uniforms.

Synopsis

Documentation

data ShaderProgram Source

Representation of a GLSL shader program that has been compiled and linked.

loadShaderProgram :: FilePath -> FilePath -> IO ShaderProgramSource

Load a ShaderProgram from a vertex shader source file and a fragment shader source file. The active attributes and uniforms in the linked program are recorded in the ShaderProgram.

loadShaderProgramWith :: FilePath -> FilePath -> (Program -> IO ()) -> IO ShaderProgramSource

Load a ShaderProgram from a vertex shader source file and a fragment shader source file. The active attributes and uniforms in the linked program are recorded in the ShaderProgram. The supplied IO function is applied to the new program after shader objects are attached to the program, but before linking. This supports the use of bindFragDataLocation to map fragment shader outputs.

loadGeoProgram :: FilePath -> FilePath -> FilePath -> IO ShaderProgramSource

Load a ShaderProgram from a vertex shader source file, a geometry shader source file, and a fragment shader source file. The active attributes and uniforms in the linked program are recorded in the ShaderProgram.

loadGeoProgramWith :: FilePath -> FilePath -> FilePath -> (Program -> IO ()) -> IO ShaderProgramSource

Load a ShaderProgram from a vertex shader source file, a geometry shader source file, and a fragment shader source file. The active attributes and uniforms in the linked program are recorded in the ShaderProgram. The supplied IO function is applied to the new program after shader objects are attached to the program, but before linking. This supports the use of bindFragDataLocation to map fragment shader outputs.

loadShaderExplicit :: FilePath -> FilePath -> ([String], [String]) -> IO ShaderProgramSource

Load a ShaderProgram from a vertex and fragment shader source files. the third argument is a tuple of the attribute names and uniform names that will be set in this program. If all attributes and uniforms are desired, consider using loadShaderProgram.

getAttrib :: ShaderProgram -> String -> AttribLocationSource

Get the AttribLocation associated with a named vertex attribute.

enableAttrib :: ShaderProgram -> String -> IO ()Source

Enable a named vertex attribute.

setUniform :: Uniform a => ShaderProgram -> String -> a -> IO ()Source

Set a named uniform parameter associated with a particular shader program.

getUniform :: ShaderProgram -> String -> UniformLocationSource

Get the UniformLocation associated with a named uniform parameter.