SFML-2.3.2.3: SFML bindings

Safe HaskellNone
LanguageHaskell98

SFML.Graphics.Shader

Synopsis

Documentation

module SFML.Utils

nullShader :: Shader Source

A null shader.

shaderFromFile Source

Arguments

:: Maybe FilePath

Path of the vertex shader file to load, or Nothing to skip this shader

-> Maybe FilePath

Path of the fragment shader file to load, or Nothing to skip this shader

-> 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.

shaderFromMemory Source

Arguments

:: Maybe String

String containing the source code of the vertex shader, or Nothing to skip this shader

-> Maybe String

String containing the source code of the fragment shader, or Nothing to skip this shader

-> 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.

shaderFromStream Source

Arguments

:: Maybe InputStream

Source stream to read the vertex shader from, or Nothing to skip this shader

-> Maybe InputStream

Source stream to read the fragment shader from, or Nothing to skip this shader

-> 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.

setFloatParameter Source

Arguments

:: Shader 
-> String

Name of the parameter in the shader

-> Float

Value to assign

-> IO () 

Change a float parameter of a shader.

setFloat2Parameter Source

Arguments

:: 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.

setFloat3Parameter Source

Arguments

:: 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.

setFloat4Parameter Source

Arguments

:: 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.

setVector2Parameter Source

Arguments

:: Shader 
-> String

Name of the parameter in the shader

-> Vec2f

Vector to assign

-> IO () 

Change a 2-components vector parameter of a shader.

setVector3Parameter Source

Arguments

:: Shader 
-> String

Name of the parameter in the shader

-> Vec3f

Vector to assign

-> IO () 

Change a 3-components vector parameter of a shader.

setColorParameter Source

Arguments

:: Shader 
-> String

Name of the parameter in the shader

-> Color

Color to assign

-> IO () 

Change a color parameter of a shader.

setTransformParameter Source

Arguments

:: Shader 
-> String

Name of the parameter in the shader

-> Transform

Transform to assign

-> IO () 

Change a matrix parameter of a shader.

setTextureParameter Source

Arguments

:: Shader 
-> String

Name of the texture in the shader

-> Texture

Texture to assign

-> IO () 

Change a texture parameter of a shader.

The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).

setCurrentTextureParameter Source

Arguments

:: Shader 
-> String

Name of the texture in the shader

-> IO () 

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.

isShaderAvailable :: IO Bool Source

Tell whether or not the system supports shaders.

This function should always be called before using the shader features. If it returns False, then any attempt to use Shader will fail.