Safe Haskell | None |
---|---|
Language | Haskell98 |
- module SFML.Utils
- nullShader :: Shader
- shaderFromFile :: Maybe FilePath -> Maybe FilePath -> IO (Either SFException Shader)
- shaderFromMemory :: Maybe String -> Maybe String -> IO (Either SFException Shader)
- shaderFromStream :: Maybe InputStream -> Maybe InputStream -> IO (Either SFException Shader)
- destroy :: SFResource a => a -> IO ()
- setFloatParameter :: Shader -> String -> Float -> IO ()
- setFloat2Parameter :: Shader -> String -> Float -> Float -> IO ()
- setFloat3Parameter :: Shader -> String -> Float -> Float -> Float -> IO ()
- setFloat4Parameter :: Shader -> String -> Float -> Float -> Float -> Float -> IO ()
- setVector2Parameter :: Shader -> String -> Vec2f -> IO ()
- setVector3Parameter :: Shader -> String -> Vec3f -> IO ()
- setColorParameter :: Shader -> String -> Color -> IO ()
- setTransformParameter :: Shader -> String -> Transform -> IO ()
- setTextureParameter :: Shader -> String -> Texture -> IO ()
- setCurrentTextureParameter :: Shader -> String -> IO ()
- bind :: SFBindable a => a -> IO ()
- isShaderAvailable :: IO Bool
Documentation
module SFML.Utils
A null shader.
:: Maybe FilePath | Path of the vertex shader file to load, or |
-> Maybe FilePath | Path of the fragment shader file to load, or |
-> IO (Either SFException Shader) |
Load both the vertex and fragment shaders from files.
This function can load both the vertex and the fragment
shaders, or only one of them: pass Nothing
if you don't want to load
either the vertex shader or the fragment shader.
The sources must be text files containing valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.
:: Maybe String | String containing the source code of the vertex shader, or |
-> Maybe String | String containing the source code of the fragment shader, or |
-> IO (Either SFException Shader) |
Load both the vertex and fragment shaders from source codes in memory.
This function can load both the vertex and the fragment
shaders, or only one of them: pass Nothing
if you don't want to load
either the vertex shader or the fragment shader.
The sources must be valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.
:: Maybe InputStream | Source stream to read the vertex shader from, or |
-> Maybe InputStream | Source stream to read the fragment shader from, or |
-> IO (Either SFException Shader) |
Load both the vertex and fragment shaders from custom streams.
This function can load both the vertex and the fragment
shaders, or only one of them: pass Nothing
if you don't want to load
either the vertex shader or the fragment shader.
The source codes must be valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.
destroy :: SFResource a => a -> IO () Source
Destroy the given SFML resource.
Change a float parameter of a shader.
:: Shader | |
-> String | Name of the parameter in the shader |
-> Float | First component of the value to assign |
-> Float | Second component of the value to assign |
-> IO () |
Change a 2-components vector parameter of a shader.
:: Shader | |
-> String | Name of the parameter in the shader |
-> Float | First component of the value to assign |
-> Float | Second component of the value to assign |
-> Float | Third component of the value to assign |
-> IO () |
Change a 3-components vector parameter of a shader.
:: Shader | |
-> String | Name of the parameter in the shader |
-> Float | First component of the value to assign |
-> Float | Second component of the value to assign |
-> Float | Third component of the value to assign |
-> Float | Fourth component of the value to assign |
-> IO () |
Change a 4-components vector parameter of a shader.
Change a 2-components vector parameter of a shader.
Change a 3-components vector parameter of a shader.
Change a color parameter of a shader.
Change a matrix parameter of a shader.
Change a texture parameter of a shader.
The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).
setCurrentTextureParameter Source
Change a texture parameter of a shader.
This function maps a shader texture variable to the texture of the object being drawn, which cannot be known in advance.
The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).
bind :: SFBindable a => a -> IO () Source
Bind the resource for rendering (activate it).
This function is not part of the graphics API, it mustn't be used when drawing SFML entities. It must be used only if you mix sfShader with OpenGL code.