MorphoGraphX  2.0-1-227
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
mgx::Shader Class Reference

#include <Shader.hpp>

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 QString & getVertexShader (unsigned int pos) const
 
const QString & getFragmentShader (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 ()
 

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_tvertex_shaders_code
 
std::vector< code_tfragment_shaders_code
 
std::vector< GLuint > vertex_shaders
 
std::vector< GLuint > fragment_shaders
 
std::vector< QString > uniform_names
 
std::vector< QString > model_uniform_names
 
std::vector< GLSLValueuniform_values
 
std::vector< GLSLValuemodel_uniform_values
 
int verbosity
 
GLuint _program
 
bool _initialized
 

Detailed Description

Definition at line 274 of file Shader.hpp.

Member Typedef Documentation

◆ code_t

typedef std::pair<QString, bool> mgx::Shader::code_t
protected

Definition at line 386 of file Shader.hpp.

Member Enumeration Documentation

◆ ActiveTextures

Enumerator
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 

Definition at line 276 of file Shader.hpp.

Constructor & Destructor Documentation

◆ Shader()

mgx::Shader::Shader ( int  verbosity = 1)

Member Function Documentation

◆ activeTexture() [1/2]

static void mgx::Shader::activeTexture ( ActiveTextures  at)
inlinestatic

Definition at line 297 of file Shader.hpp.

◆ activeTexture() [2/2]

static void mgx::Shader::activeTexture ( int  at)
inlinestatic

Definition at line 301 of file Shader.hpp.

◆ addFragmentShader()

void mgx::Shader::addFragmentShader ( const QString &  filename)

◆ addFragmentShaderCode()

void mgx::Shader::addFragmentShaderCode ( const QString &  code)

◆ addVertexShader()

void mgx::Shader::addVertexShader ( const QString &  filename)

◆ addVertexShaderCode()

void mgx::Shader::addVertexShaderCode ( const QString &  code)

◆ attribLocation()

GLuint mgx::Shader::attribLocation ( const QString &  name)

◆ changeFragmentShader()

bool mgx::Shader::changeFragmentShader ( int  pos,
const QString &  filename 
)

◆ changeFragmentShaderCode()

bool mgx::Shader::changeFragmentShaderCode ( int  pos,
const QString &  code 
)

◆ changeVertexShader()

bool mgx::Shader::changeVertexShader ( int  pos,
const QString &  filename 
)

◆ changeVertexShaderCode()

bool mgx::Shader::changeVertexShaderCode ( int  pos,
const QString &  code 
)

◆ cleanShaders()

void mgx::Shader::cleanShaders ( )

◆ compileShader()

GLuint mgx::Shader::compileShader ( GLenum  shader_type,
QString  content 
)

◆ compileShaderFile()

GLuint mgx::Shader::compileShaderFile ( GLenum  shader_type,
QString  filename 
)

◆ getFragmentShader()

const QString& mgx::Shader::getFragmentShader ( unsigned int  pos) const
inline

Definition at line 328 of file Shader.hpp.

◆ getVertexShader()

const QString& mgx::Shader::getVertexShader ( unsigned int  pos) const
inline

Definition at line 324 of file Shader.hpp.

◆ hasShaders()

bool mgx::Shader::hasShaders ( ) const
inline

Definition at line 358 of file Shader.hpp.

◆ init()

bool mgx::Shader::init ( )

◆ initialized()

bool mgx::Shader::initialized ( ) const
inline

Definition at line 376 of file Shader.hpp.

◆ invalidate()

void mgx::Shader::invalidate ( )
inline

Definition at line 306 of file Shader.hpp.

◆ isFragmentShaderCode()

bool mgx::Shader::isFragmentShaderCode ( unsigned int  pos) const
inline

Definition at line 320 of file Shader.hpp.

◆ isVertexShaderCode()

bool mgx::Shader::isVertexShaderCode ( unsigned int  pos) const
inline

Definition at line 316 of file Shader.hpp.

◆ loadUniform()

void mgx::Shader::loadUniform ( GLint  program,
const QString &  name,
const GLSLValue value 
)
protected

◆ printProgramInfoLog()

void mgx::Shader::printProgramInfoLog ( GLuint  object)

◆ printShaderInfoLog()

void mgx::Shader::printShaderInfoLog ( GLuint  object)

◆ program()

GLuint mgx::Shader::program ( ) const
inline

Definition at line 362 of file Shader.hpp.

◆ removeFragmentShader()

void mgx::Shader::removeFragmentShader ( const QString &  filename)

◆ removeFragmentShaderCode()

void mgx::Shader::removeFragmentShaderCode ( const QString &  code)

◆ removeVertexShader()

void mgx::Shader::removeVertexShader ( const QString &  filename)

◆ removeVertexShaderCode()

void mgx::Shader::removeVertexShaderCode ( const QString &  code)

◆ setAttrib() [1/2]

void mgx::Shader::setAttrib ( const QString &  name,
const GLSLValue value 
)

◆ setAttrib() [2/2]

void mgx::Shader::setAttrib ( GLuint  loc,
const GLSLValue value 
)

◆ setUniform()

bool mgx::Shader::setUniform ( const QString &  name,
const GLSLValue value 
)

◆ setUniform_instant()

void mgx::Shader::setUniform_instant ( const QString &  name,
const GLSLValue value 
)

◆ setupShaders()

bool mgx::Shader::setupShaders ( )

◆ setupUniforms()

void mgx::Shader::setupUniforms ( )

◆ setVerbosity()

void mgx::Shader::setVerbosity ( int  verb)
inline

Definition at line 345 of file Shader.hpp.

◆ shaderTypeName()

QString mgx::Shader::shaderTypeName ( GLenum  shader_type)

◆ stopUsingShaders()

static bool mgx::Shader::stopUsingShaders ( )
static

◆ useShaders()

bool mgx::Shader::useShaders ( )

Member Data Documentation

◆ _initialized

bool mgx::Shader::_initialized
protected

Definition at line 398 of file Shader.hpp.

◆ _program

GLuint mgx::Shader::_program
protected

Definition at line 396 of file Shader.hpp.

◆ fragment_shaders

std::vector<GLuint> mgx::Shader::fragment_shaders
protected

Definition at line 389 of file Shader.hpp.

◆ fragment_shaders_code

std::vector<code_t> mgx::Shader::fragment_shaders_code
protected

Definition at line 387 of file Shader.hpp.

◆ has_shaders

bool mgx::Shader::has_shaders
protected

Definition at line 383 of file Shader.hpp.

◆ model_uniform_names

std::vector<QString> mgx::Shader::model_uniform_names
protected

Definition at line 391 of file Shader.hpp.

◆ model_uniform_values

std::vector<GLSLValue> mgx::Shader::model_uniform_values
protected

Definition at line 392 of file Shader.hpp.

◆ uniform_names

std::vector<QString> mgx::Shader::uniform_names
protected

Definition at line 391 of file Shader.hpp.

◆ uniform_values

std::vector<GLSLValue> mgx::Shader::uniform_values
protected

Definition at line 392 of file Shader.hpp.

◆ verbosity

int mgx::Shader::verbosity
protected

Definition at line 394 of file Shader.hpp.

◆ vertex_shaders

std::vector<GLuint> mgx::Shader::vertex_shaders
protected

Definition at line 389 of file Shader.hpp.

◆ vertex_shaders_code

std::vector<code_t> mgx::Shader::vertex_shaders_code
protected

Definition at line 387 of file Shader.hpp.


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