Safe Haskell | None |
---|
Graphics.GLUtil.ShaderProgram
Contents
Description
Convenience interface for working with GLSL shader programs. Provides an interface for setting attributes and uniforms.
- data ShaderProgram = ShaderProgram {}
- simpleShaderProgram :: FilePath -> FilePath -> IO ShaderProgram
- simpleShaderProgramWith :: FilePath -> FilePath -> (Program -> IO ()) -> IO ShaderProgram
- simpleShaderExplicit :: FilePath -> FilePath -> ([String], [String]) -> IO ShaderProgram
- simpleShaderProgramBS :: ByteString -> ByteString -> IO ShaderProgram
- simpleShaderProgramWithBS :: ByteString -> ByteString -> (Program -> IO ()) -> IO ShaderProgram
- simpleShaderExplicitBS :: ByteString -> ByteString -> ([String], [String]) -> IO ShaderProgram
- loadShaderProgram :: [(ShaderType, FilePath)] -> IO ShaderProgram
- loadShaderProgramWith :: [(ShaderType, FilePath)] -> (Program -> IO ()) -> IO ShaderProgram
- loadShaderProgramBS :: [(ShaderType, ByteString)] -> IO ShaderProgram
- loadShaderProgramWithBS :: [(ShaderType, ByteString)] -> (Program -> IO ()) -> 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
The ShaderProgram type
data ShaderProgram Source
Representation of a GLSL shader program that has been compiled and linked.
Constructors
ShaderProgram | |
Fields
|
Simple shader programs utilizing a vertex shader and a fragment shader
simpleShaderProgram :: 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
.
simpleShaderProgramWith :: 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.
simpleShaderExplicit :: 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
.
simpleShaderProgramBS :: ByteString -> ByteString -> IO ShaderProgramSource
Load a ShaderProgram
from vertex and fragment shader source
strings. The active attributes and uniforms in the linked program
are recorded in the ShaderProgram
.
simpleShaderProgramWithBS :: ByteString -> ByteString -> (Program -> IO ()) -> IO ShaderProgramSource
Load a ShaderProgram
from vertex and fragment shader source
strings. See simpleShaderProgramWith
for more information.
simpleShaderExplicitBS :: ByteString -> ByteString -> ([String], [String]) -> IO ShaderProgramSource
Explicit shader loading
loadShaderProgram :: [(ShaderType, FilePath)] -> IO ShaderProgramSource
Load a ShaderProgram
from a list of individual shader program
files. The active attributes and uniforms in the linked program are
recorded in the ShaderProgram
loadShaderProgramWith :: [(ShaderType, FilePath)] -> (Program -> IO ()) -> IO ShaderProgramSource
loadShaderProgramBS :: [(ShaderType, ByteString)] -> IO ShaderProgramSource
Load a ShaderProgram
from a list of individual shader program
source strings. The active attributes and uniforms in the linked program are
recorded in the ShaderProgram
loadShaderProgramWithBS :: [(ShaderType, ByteString)] -> (Program -> IO ()) -> IO ShaderProgramSource
Working with ShaderProgram parameters
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.