igor::iShaderProgram Class Reference

#include <iShaderProgram.h>

Public Member Functions

 iShaderProgram ()
 
virtual ~iShaderProgram ()
 
void addShader (const iaString &filename, iShaderObjectType type)
 
const std::vector< iShaderSource > & getShaderSources () const
 
bool addSource (const char *source, iShaderObjectType type, const iaString &sourceName="")
 
void compile ()
 
bool isValid ()
 
void bind ()
 
void unbind ()
 
void setInt (const iaString &uniform, int value)
 
void setFloat (const iaString &uniform, float32 value)
 
void setFloat2 (const iaString &uniform, const iaVector2f &value)
 
void setFloat3 (const iaString &uniform, const iaVector3f &value)
 
void setFloat4 (const iaString &uniform, const iaVector4f &value)
 
void setMatrix (const iaString &uniform, const iaMatrixf &value)
 
bool hasUniformLocation (const iaString &uniform)
 

Static Public Member Functions

static iShaderProgramPtr create ()
 

Detailed Description

glsl shader program wrapper

Constructor & Destructor Documentation

◆ iShaderProgram()

igor::iShaderProgram::iShaderProgram ( )

initializes shader program

◆ ~iShaderProgram()

igor::iShaderProgram::~iShaderProgram ( )
virtual

destroys shader program

Member Function Documentation

◆ addShader()

void igor::iShaderProgram::addShader ( const iaString filename,
iShaderObjectType  type 
)

add shader object from file

Parameters
filenamefile name to shader definition
typethe type of shader object.

If type is undefined we use the file ending to determine the type

◆ addSource()

bool igor::iShaderProgram::addSource ( const char *  source,
iShaderObjectType  type,
const iaString sourceName = "" 
)

add shader from buffer

Parameters
sourcepointer to buffer with shader definition (zero terminated)
typethe type of shader object
Returns
true if sucessful

◆ bind()

void igor::iShaderProgram::bind ( )

activates shader program

◆ compile()

void igor::iShaderProgram::compile ( )

compiles shader programm with shader objects

◆ create()

iShaderProgramPtr igor::iShaderProgram::create ( )
static
Returns
a newly created shader program

◆ getShaderSources()

const std::vector< iShaderSource > & igor::iShaderProgram::getShaderSources ( ) const
Returns
shader source files

it does not return sources added via addSource

◆ hasUniformLocation()

bool igor::iShaderProgram::hasUniformLocation ( const iaString uniform)
Returns
true if shader has given uniform location
Parameters
uniformthe given uniform location

◆ isValid()

bool igor::iShaderProgram::isValid ( )
Returns
true: if ready to use

◆ setFloat()

void igor::iShaderProgram::setFloat ( const iaString uniform,
float32  value 
)

sets float on given uniform

Parameters
uniformthe uniform name
valuethe value to set

◆ setFloat2()

void igor::iShaderProgram::setFloat2 ( const iaString uniform,
const iaVector2f value 
)

sets 2 dimensional vector on given uniform

Parameters
uniformthe uniform name
valuethe value to set

◆ setFloat3()

void igor::iShaderProgram::setFloat3 ( const iaString uniform,
const iaVector3f value 
)

sets 3 dimensional vector on given uniform

Parameters
uniformthe uniform name
valuethe value to set

◆ setFloat4()

void igor::iShaderProgram::setFloat4 ( const iaString uniform,
const iaVector4f value 
)

sets 4 dimensional vector on given uniform

Parameters
uniformthe uniform name
valuethe value to set

◆ setInt()

void igor::iShaderProgram::setInt ( const iaString uniform,
int  value 
)

sets integer on given uniform

Parameters
uniformthe uniform name
valuethe value to set

◆ setMatrix()

void igor::iShaderProgram::setMatrix ( const iaString uniform,
const iaMatrixf value 
)

sets 4x4 matrix on given uniform

Parameters
uniformthe uniform name
valuethe value to set

◆ unbind()

void igor::iShaderProgram::unbind ( )

deactivates shader program


The documentation for this class was generated from the following files: