MorphoGraphX
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
mgx::Shader Class Reference

Public Types

enum  ActiveTextures {
  AT_NONE, AT_TEX3D, AT_SECOND_TEX3D, AT_TEX2D,
  AT_LABEL_TEX, AT_SURF_TEX, AT_HEAT_TEX, AT_DEPTH_TEX,
  AT_CMAP_TEX, AT_SECOND_CMAP_TEX, AT_SURF_RENDER_TEX, AT_FINAL_VOLUME_TEX,
  AT_FRONT_TEX, AT_BACK_TEX, AT_FRONT_COLOR_TEX, AT_OCCLUSION_TEX,
  AT_END
}
 

Public Member Functions

 Shader (int verbosity=1)
 
bool init ()
 
void invalidate ()
 
bool setupShaders ()
 
bool useShaders ()
 
bool isVertexShaderCode (unsigned int pos) const
 
bool isFragmentShaderCode (unsigned int pos) const
 
const QStringgetVertexShader (unsigned int pos) const
 
const QStringgetFragmentShader (unsigned int pos) const
 
void addVertexShaderCode (const QString &code)
 
bool changeVertexShaderCode (int pos, const QString &code)
 
void removeVertexShaderCode (const QString &code)
 
void addFragmentShaderCode (const QString &code)
 
bool changeFragmentShaderCode (int pos, const QString &code)
 
void removeFragmentShaderCode (const QString &code)
 
void addVertexShader (const QString &filename)
 
bool changeVertexShader (int pos, const QString &filename)
 
void removeVertexShader (const QString &filename)
 
void addFragmentShader (const QString &filename)
 
bool changeFragmentShader (int pos, const QString &filename)
 
void removeFragmentShader (const QString &filename)
 
void setVerbosity (int verb)
 
QString shaderTypeName (GLenum shader_type)
 
GLuint compileShaderFile (GLenum shader_type, QString filename)
 
GLuint compileShader (GLenum shader_type, QString content)
 
void printProgramInfoLog (GLuint object)
 
void printShaderInfoLog (GLuint object)
 
void cleanShaders ()
 
bool hasShaders () const
 
GLuint program () const
 
void setupUniforms ()
 
GLuint attribLocation (const QString &name)
 
void setAttrib (const QString &name, const GLSLValue &value)
 
void setAttrib (GLuint loc, const GLSLValue &value)
 
bool setUniform (const QString &name, const GLSLValue &value)
 
void setUniform_instant (const QString &name, const GLSLValue &value)
 
bool initialized () const
 

Static Public Member Functions

static void activeTexture (ActiveTextures at)
 
static void activeTexture (int at)
 
static bool stopUsingShaders ()
 
static bool reportGLError (const char *id, const char *file, int line)
 
static bool reportGLError (const QString &id, const char *file, int line)
 

Protected Types

typedef std::pair< QString, bool > code_t
 

Protected Member Functions

void loadUniform (GLint program, const QString &name, const GLSLValue &value)
 

Protected Attributes

bool has_shaders
 
std::vector< code_t > vertex_shaders_code
 
std::vector< code_t > fragment_shaders_code
 
std::vector< GLuint > vertex_shaders
 
std::vector< GLuint > fragment_shaders
 
std::vector< QStringuniform_names
 
std::vector< QStringmodel_uniform_names
 
std::vector< GLSLValueuniform_values
 
std::vector< GLSLValuemodel_uniform_values
 
int verbosity
 
GLuint _program
 
bool _initialized
 

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