Gamedev Framework (gf)  0.17.0
A C++14 framework for 2D games
Protected Member Functions | List of all members
gf::Effect Class Reference

A post-processing effect. More...

#include <gf/Effect.h>

Inheritance diagram for gf::Effect:
Inheritance graph
[legend]

Protected Member Functions

 Effect (const char *vertexShader, const char *fragmentShader)
 Load both the vertex and fragment shaders from source codes in memory. More...
 

Additional Inherited Members

- Public Types inherited from gf::Shader
enum  Type {
  Vertex,
  Fragment
}
 Type of shaders. More...
 
- Public Member Functions inherited from gf::Shader
 Shader ()
 Default constructor. More...
 
 Shader (const Path &filename, Type type)
 Load the vertex of fragment shader from a file. More...
 
 Shader (const Path &vertexShaderFilename, const Path &fragmentShaderFilename)
 Load both the vertex and fragment shaders from files. More...
 
 Shader (const char *shader, Type type)
 Load the vertex or fragment shader from a source code in memory. More...
 
 Shader (const char *vertexShader, const char *fragmentShader)
 Load both the vertex and fragment shaders from source codes in memory. More...
 
 Shader (InputStream &stream, Type type)
 Load the vertex or fragment shader from a custom stream. More...
 
 Shader (InputStream &vertexShaderStream, InputStream &fragmentShaderStream)
 Load both the vertex and fragment shaders from custom streams. More...
 
 ~Shader ()
 Destructor. More...
 
 Shader (const Shader &)=delete
 Deleted copy constructor. More...
 
Shaderoperator= (const Shader &)=delete
 Deleted copy assignment. More...
 
void setUniform (StringRef name, float val)
 Specify value for a float uniform. More...
 
void setUniform (StringRef name, int val)
 Specify value for a int uniform. More...
 
void setUniform (StringRef name, const Vector2f &vec)
 Specify value for a vec2 uniform. More...
 
void setUniform (StringRef name, const Vector3f &vec)
 Specify value for a vec3 uniform. More...
 
void setUniform (StringRef name, const Vector4f &vec)
 Specify value for a vec4 uniform. More...
 
void setUniform (StringRef name, const Vector2i &vec)
 Specify value for a ivec2 uniform. More...
 
void setUniform (StringRef name, const Vector3i &vec)
 Specify value for a ivec3 uniform. More...
 
void setUniform (StringRef name, const Vector4i &vec)
 Specify value for a ivec4 uniform. More...
 
void setUniform (StringRef name, const Matrix3f &mat)
 Specify value for a mat3 uniform. More...
 
void setUniform (StringRef name, const Matrix4f &mat)
 Specify value for a mat4 uniform. More...
 
void setUniform (StringRef name, const BareTexture &tex)
 Specify a texture for a sampler2D uniform. More...
 
- Static Public Member Functions inherited from gf::Shader
static void bind (const Shader *shader)
 Bind a shader for rendering. More...
 

Detailed Description

A post-processing effect.

See also
gf::PostProcessing

Constructor & Destructor Documentation

◆ Effect()

gf::Effect::Effect ( const char *  vertexShader,
const char *  fragmentShader 
)
inlineprotected

Load both the vertex and fragment shaders from source codes in memory.

This function loads both the vertex and the fragment shaders. If one of them fails to load, the shader is left empty (the valid shader is unloaded).

The source codes must be a 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.

Parameters
vertexShaderString containing the source code of the vertex shader
fragmentShaderString containing the source code of the fragment shader