Safe Haskell | None |
---|
Graphics.GLUtil.ShaderProgram
Description
Convenience interface for working with GLSL shader programs. Provides an interface for setting attributes and uniforms.
- data ShaderProgram = ShaderProgram {}
- loadShaderProgram :: FilePath -> FilePath -> IO ShaderProgram
- loadShaderProgramWith :: FilePath -> FilePath -> (Program -> IO ()) -> IO ShaderProgram
- loadGeoProgram :: FilePath -> FilePath -> FilePath -> IO ShaderProgram
- loadGeoProgramWith :: FilePath -> FilePath -> FilePath -> (Program -> IO ()) -> IO ShaderProgram
- loadShaderExplicit :: FilePath -> FilePath -> ([String], [String]) -> IO ShaderProgram
- getAttrib :: ShaderProgram -> String -> AttribLocation
- enableAttrib :: ShaderProgram -> String -> IO ()
- setAttrib :: ShaderProgram -> String -> IntegerHandling -> VertexArrayDescriptor a -> IO ()
- setUniform :: Uniform a => ShaderProgram -> String -> a -> IO ()
- getUniform :: ShaderProgram -> String -> UniformLocation
Documentation
data ShaderProgram Source
Representation of a GLSL shader program that has been compiled and linked.
Constructors
ShaderProgram | |
Fields
|
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.
setAttrib :: ShaderProgram -> String -> IntegerHandling -> VertexArrayDescriptor a -> IO ()Source
Set a named vertex attribute's IntegerHandling
and
VertexArrayDescriptor
.
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.