Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
LxS::CoreGraphics::Shader Class Reference

class represents pair of vertex/fragment programs (coompiled from GLSL) More...

#include <shader.hpp>

Collaboration diagram for LxS::CoreGraphics::Shader:
Collaboration graph

Public Types

typedef std::vector< std::string > AttribVector
 vector of attributes
 
typedef std::vector< std::pair
< std::string, std::string > > 
TexInfoVector
 vector of assigned textures
 

Public Member Functions

void SetTexMagFilter (GLint mf)
 
void SetTexMinFilter (GLint mf)
 
unsigned long GetTexelsCount ()
 get amount of texels within all textures linked to this shader, together
 
void SetPath (std::string shader_path)
 
void SetTextures (const TexInfoVector &textures)
 
void SetRelevantAttributes (const AttribVector &relevantAttributes)
 set all GL attribs important when shader will be used
 
void SetRelevantUniforms (const std::vector< std::string > relevantuniforms)
 
void Set4InitializationParams (const std::string &path, TexInfoVector textures, AttribVector relevantAttributes, const std::vector< std::string > relevantuniforms)
 
void Initialize (const std::string &path, TexInfoVector textures, AttribVector relevantAttributes)
 Initialize with parameters given.
 
void Initialize (const std::string &path, TexInfoVector textures, AttribVector relevantAttributes, const std::vector< std::string > relevantuniforms)
 initialize with parameters given
 
void Initialize ()
 initialize - default function - is called after all params have been set up
 
void UseUniformVector4 (const char *uniformname, const GLfloat *value)
 use 4dimensional vector as uniform
 
void Use ()
 
void Deinitialize ()
 free textureset resources
 
GLint GetAttribLocation (std::string name)
 GLuint GetProgramHandle() {return programObject_Handle;}.
 
GLint GetProjectionMatrixLocation ()
 Get location of projection matrix - an opengl handle.
 
void UseVertexAttribPointer (std::string name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)
 vertex attributes (xyz of vertices, uv coordinates of textures)
 
void UseProjectionMatrix (const GLfloat *value=0)
 
void UseModelMatrix (const GLfloat *value)
 
bool IsInitialized ()
 return true if a shader is usable
 
float GetInitializedPercentage ()
 just to simulate LxS::CoreGraphics::Renderable interface
 

Static Public Member Functions

static void ReloadAllShaders ()
 used to implement android run states and moving between OpenGL contexts
 
static void MarkNecessityToReload ()
 after losing context, graphics glitches etc
 
static void PrintGlobalStatus ()
 prints infodump on all shaders to a console
 
static void UseUniformVector4ForAllShaders (const char *uniformname, const GLfloat *value)
 using uniform as 4-dimensional vector.
 

Detailed Description

class represents pair of vertex/fragment programs (coompiled from GLSL)

Member Function Documentation

void LxS::CoreGraphics::Shader::Set4InitializationParams ( const std::string &  path,
TexInfoVector  textures,
AttribVector  relevantAttributes,
const std::vector< std::string >  relevantuniforms 
)
inline

set all 4 initialization params (see descriptions for other functions to see what they do)

void LxS::CoreGraphics::Shader::SetPath ( std::string  shader_path)
inline

set shader path

Parameters
shader_pathpath to program file, excluding extension (pair of .fsr and .vsr files assumed to exist at path given);
void LxS::CoreGraphics::Shader::SetRelevantUniforms ( const std::vector< std::string >  relevantuniforms)
inline

set all GL/GLSL uniforms (variables passed to shader) that will be necessary when shader will be used

void LxS::CoreGraphics::Shader::SetTexMagFilter ( GLint  mf)
inline

set filter - applies to all textures used by this particular shading object

void LxS::CoreGraphics::Shader::SetTexMinFilter ( GLint  mf)
inline

set minification filter (OpenGL) - applies to all textures used by this particular shading object

void LxS::CoreGraphics::Shader::SetTextures ( const TexInfoVector textures)
inline

set pair of name and path of texture (set of such pairs actually) for initialization

void Shader::Use ( )

set up everything before calling mesh. Note, that you must set all the uniforms, matrices etc BEFORE handling this

void Shader::UseModelMatrix ( const GLfloat *  value)

model matrix is yet another matrix apart of camera matrix - used for model rotation and translation. Note that this engine does NOT feature complete matrices stack

Parameters
valuepointer to first of 16 floats constituting a matrix
void Shader::UseProjectionMatrix ( const GLfloat *  value = 0)

use projection matrix (camera)

Parameters
valuepointer to first of 16 floats constituting a matrix

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