lowgl-0.2.0.0: Basic gl wrapper and reference

Safe HaskellNone
LanguageHaskell2010

Graphics.GL.Low.Shader

Synopsis

Documentation

data Program

A Program object is the combination of a compiled vertex shader and fragment shader. Programs have three kinds of inputs: vertex attributes, uniforms, and samplers. Programs have two outputs: fragment color and fragment depth. At most one program can be "in use" at a time. Same idea as binding targets it's just not called that.

Instances

data ProgramError

The error message emitted by the driver when shader compilation or linkage fails.

newProgramSafe :: String -> String -> IO (Either ProgramError Program)

Same as newProgram but does not throw exceptions.

deleteProgram :: Program -> IO ()

Delete a program.

newProgram

Arguments

:: String

vertex shader source code

-> String

fragment shader source code

-> IO Program 

Compile the code for a vertex shader and a fragment shader, then link them into a new program. If the compiler or linker fails it will throw a ProgramError.

useProgram :: Program -> IO ()

Install a program into the rendering pipeline. Replaces the program already in use, if any.

setUniform1f :: String -> [Float] -> IO ()

setUniform2f :: String -> [V2 Float] -> IO ()

setUniform3f :: String -> [V3 Float] -> IO ()

setUniform4f :: String -> [V4 Float] -> IO ()

setUniform1i :: String -> [Int] -> IO ()

setUniform2i :: String -> [V2 Int] -> IO ()

setUniform3i :: String -> [V3 Int] -> IO ()

setUniform4i :: String -> [V4 Int] -> IO ()