pmp-library  1.0

shader class for easy handling of the shader More...

#include <pmp/visualization/Shader.h>

Public Member Functions

 Shader ()
 default constructor
 
 ~Shader ()
 default destructor
 
bool is_valid () const
 is shader valid (ID != 0)
 
bool source (const char *vshader, const char *fshader)
 get source from strings, compile, and link vertex and fragment shader, More...
 
bool load (const char *vfile, const char *ffile)
 load (from file), compile, and link vertex and fragment shader, More...
 
void use ()
 enable/bind this shader program
 
void disable ()
 disable/unbind this shader program
 
void bind_attribute (const char *name, GLuint index)
 bind attribute to location
 
void set_uniform (const char *name, float value)
 upload float uniform More...
 
void set_uniform (const char *name, int value)
 upload int uniform More...
 
void set_uniform (const char *name, const vec3 &vec)
 upload vec3 uniform More...
 
void set_uniform (const char *name, const vec4 &vec)
 upload vec4 uniform More...
 
void set_uniform (const char *name, const mat3 &mat)
 upload mat3 uniform More...
 
void set_uniform (const char *name, const mat4 &mat)
 upload mat4 uniform More...
 

Detailed Description

shader class for easy handling of the shader

Member Function Documentation

bool load ( const char *  vfile,
const char *  ffile 
)

load (from file), compile, and link vertex and fragment shader,

Parameters
vfilestring with the adress to the vertex shader
ffilestring with the adress to the fragment shader
void set_uniform ( const char *  name,
float  value 
)

upload float uniform

Parameters
namestring of the uniform name
valuethe value for the uniform
void set_uniform ( const char *  name,
int  value 
)

upload int uniform

Parameters
namestring of the uniform name
valuethe value for the uniform
void set_uniform ( const char *  name,
const vec3 vec 
)

upload vec3 uniform

Parameters
namestring of the uniform name
vecthe value for the uniform
void set_uniform ( const char *  name,
const vec4 vec 
)

upload vec4 uniform

Parameters
namestring of the uniform name
vecthe value for the uniform
void set_uniform ( const char *  name,
const mat3 mat 
)

upload mat3 uniform

Parameters
namestring of the uniform name
matthe value for the uniform
void set_uniform ( const char *  name,
const mat4 mat 
)

upload mat4 uniform

Parameters
namestring of the uniform name
matthe value for the uniform
bool source ( const char *  vshader,
const char *  fshader 
)

get source from strings, compile, and link vertex and fragment shader,

Parameters
vshaderstring with the adress to the vertex shader
fshaderstring with the adress to the fragment shader