Assignments Assignments

Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
GLSLProgram Class Reference

`#include <GLSLProgram.h>`

## Public Member Functions
| GLSLProgram (const std::string &vs_filename, const std::string &fs_filename)
| ~GLSLProgram (void)
void | compileShader (const std::string &source, GLenum type)
void | link (void)
void | validate (void)
void | use (void)
GLuint | handle (void) const
bool | linked (void) const
void | setUniform (const std::string &name, int val, bool showWarning=true)
void | setUniform (const std::string &name, float val, bool showWarning=true)
void | setUniform (const std::string &name, double val, bool showWarning=true)
template<unsigned int>
void | setUniform (const std::string &name, const int *v, bool showWarning=true)
template<unsigned int>
void | setUniform (const std::string &name, const float *v, bool showWarning=true)
template<unsigned int>
void | setUniform (const std::string &name, const double *v, bool showWarning=true)
template<unsigned int>
void | setUniformMatrix (const std::string &name, const float *m, bool showWarning=true)
template<unsigned int>
void | setUniformMatrix (const std::string &name, const double *m, bool showWarning=true)
void | init (void)

## Static Public Member Functions
static bool | FileExists (const std::string &fileName)
static std::string | GetExtension (const std::string &fileName)
static GLenum | GetShaderType (const std::string &fileName)
static std::string | GetShaderTypeString (GLenum type)

## Private Member Functions
| GLSLProgram (const GLSLProgram &other)
GLSLProgram & | operator= (const GLSLProgram &other)

## Static Private Member Functions
template<unsigned int Dim>
static void | glUniformiv (GLint location, GLsizei count, const GLint *value)
template<unsigned int Dim>
static void | glUniformfv (GLint location, GLsizei count, const GLfloat *value)
template<unsigned int Dim>
static void | glUniformMatrixfv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
template<>
void | glUniformiv (GLint location, GLsizei count, const GLint *value)
template<>
void | glUniformiv (GLint location, GLsizei count, const GLint *value)
template<>
void | glUniformiv (GLint location, GLsizei count, const GLint *value)
template<>
void | glUniformiv (GLint location, GLsizei count, const GLint *value)
template<>
void | glUniformfv (GLint location, GLsizei count, const GLfloat *value)
template<>
void | glUniformfv (GLint location, GLsizei count, const GLfloat *value)
template<>
void | glUniformfv (GLint location, GLsizei count, const GLfloat *value)
template<>
void | glUniformfv (GLint location, GLsizei count, const GLfloat *value)
template<>
void | glUniformMatrixfv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
template<>
void | glUniformMatrixfv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
template<>
void | glUniformMatrixfv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)

## Private Attributes
GLuint | _handle
bool | _linked
std::string | _vertexSource
std::string | _fragmentSource

## Detailed Description

This class describes a GLSL program consisting of a vertex and fragment shader.

## Constructor & Destructor Documentation

## ◆ GLSLProgram() [1/2]

GLSLProgram::GLSLProgram | ( | const GLSLProgram & | other | ) |
| inline private

## ◆ GLSLProgram() [2/2]

GLSLProgram::GLSLProgram | ( | const std::string & | vs_filename,
|  | const std::string & | fs_filename )

## ◆ ~GLSLProgram()

GLSLProgram::~GLSLProgram | ( | void |  | ) |

## Member Function Documentation

## ◆ compileShader()

void GLSLProgram::compileShader | ( | const std::string & | source,
|  | GLenum | type )

This method compiles the specified shader from the source

## ◆ FileExists()

bool GLSLProgram::FileExists | ( | const std::string & | fileName | ) |
| static

## ◆ GetExtension()

std::string GLSLProgram::GetExtension | ( | const std::string & | fileName | ) |
| static

## ◆ GetShaderType()

GLenum GLSLProgram::GetShaderType | ( | const std::string & | fileName | ) |
| static

## ◆ GetShaderTypeString()

std::string GLSLProgram::GetShaderTypeString | ( | GLenum | type | ) |
| static

## ◆ glUniformfv() [1/5]

template<>

void GLSLProgram::glUniformfv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLfloat * | value )
| static private

## ◆ glUniformfv() [2/5]

template<>

void GLSLProgram::glUniformfv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLfloat * | value )
| static private

## ◆ glUniformfv() [3/5]

template<>

void GLSLProgram::glUniformfv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLfloat * | value )
| static private

## ◆ glUniformfv() [4/5]

template<>

void GLSLProgram::glUniformfv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLfloat * | value )
| static private

## ◆ glUniformfv() [5/5]

template<unsigned int Dim>

static void GLSLProgram::glUniformfv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLfloat * | value )
| static private

## ◆ glUniformiv() [1/5]

template<>

void GLSLProgram::glUniformiv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLint * | value )
| static private

## ◆ glUniformiv() [2/5]

template<>

void GLSLProgram::glUniformiv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLint * | value )
| static private

## ◆ glUniformiv() [3/5]

template<>

void GLSLProgram::glUniformiv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLint * | value )
| static private

## ◆ glUniformiv() [4/5]

template<>

void GLSLProgram::glUniformiv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLint * | value )
| static private

## ◆ glUniformiv() [5/5]

template<unsigned int Dim>

static void GLSLProgram::glUniformiv | ( | GLint | location,
|  | GLsizei | count,
|  | const GLint * | value )
| static private

## ◆ glUniformMatrixfv() [1/4]

template<>

void GLSLProgram::glUniformMatrixfv | ( | GLint | location,
|  | GLsizei | count,
|  | GLboolean | transpose,
|  | const GLfloat * | value )
| static private

## ◆ glUniformMatrixfv() [2/4]

template<>

void GLSLProgram::glUniformMatrixfv | ( | GLint | location,
|  | GLsizei | count,
|  | GLboolean | transpose,
|  | const GLfloat * | value )
| static private

## ◆ glUniformMatrixfv() [3/4]

template<>

void GLSLProgram::glUniformMatrixfv | ( | GLint | location,
|  | GLsizei | count,
|  | GLboolean | transpose,
|  | const GLfloat * | value )
| static private

## ◆ glUniformMatrixfv() [4/4]

template<unsigned int Dim>

static void GLSLProgram::glUniformMatrixfv | ( | GLint | location,
|  | GLsizei | count,
|  | GLboolean | transpose,
|  | const GLfloat * | value )
| static private

## ◆ handle()

GLuint GLSLProgram::handle | ( | void |  | ) | const
| inline

This method return the OpenGL handle to the shader

## ◆ init()

void GLSLProgram::init | ( | void |  | ) |

This method sets up the program.

## ◆ link()

void GLSLProgram::link | ( | void |  | ) |

This method links together the vertex and fragment shaders

## ◆ linked()

bool GLSLProgram::linked | ( | void |  | ) | const
| inline

This method return a boolean value indicating if the shader was (successfully) linked

## ◆ operator=()

GLSLProgram & GLSLProgram::operator= | ( | const GLSLProgram & | other | ) |
| inline private

## ◆ setUniform() [1/6]

template<unsigned int Dim>

void GLSLProgram::setUniform | ( | const std::string & | name,
|  | const double * | v,
|  | bool | showWarning = true )

This method sets an an double-precision floating point array uniform value with the specified name. The template parameter indicates the dimensionality of the array.

## ◆ setUniform() [2/6]

template<unsigned int Dim>

void GLSLProgram::setUniform | ( | const std::string & | name,
|  | const float * | v,
|  | bool | showWarning = true )

This method sets an an single-precision floating point array uniform value with the specified name. The template parameter indicates the dimensionality of the array.

## ◆ setUniform() [3/6]

template<unsigned int Dim>

void GLSLProgram::setUniform | ( | const std::string & | name,
|  | const int * | v,
|  | bool | showWarning = true )

This method sets an an integer array uniform value with the specified name. The template parameter indicates the dimensionality of the array.

## ◆ setUniform() [4/6]

void GLSLProgram::setUniform | ( | const std::string & | name,
|  | double | val,
|  | bool | showWarning = true )

This method sets an double-precision floating uniform value with the specified name.

## ◆ setUniform() [5/6]

void GLSLProgram::setUniform | ( | const std::string & | name,
|  | float | val,
|  | bool | showWarning = true )

This method sets a single-precision floating point unfiform value with the specified name.

## ◆ setUniform() [6/6]

void GLSLProgram::setUniform | ( | const std::string & | name,
|  | int | val,
|  | bool | showWarning = true )

This method sets an integer uniform value with the specified name.

## ◆ setUniformMatrix() [1/2]

template<unsigned int Dim>

void GLSLProgram::setUniformMatrix | ( | const std::string & | name,
|  | const double * | m,
|  | bool | showWarning = true )

This method sets an a double-precision floating point matrix uniform value with the specified name. The template parameter indicates the dimensionality of the matrix.

## ◆ setUniformMatrix() [2/2]

template<unsigned int Dim>

void GLSLProgram::setUniformMatrix | ( | const std::string & | name,
|  | const float * | m,
|  | bool | showWarning = true )

This method sets an a single-precision floating point matrix uniform value with the specified name. The template parameter indicates the dimensionality of the matrix.

## ◆ use()

void GLSLProgram::use | ( | void |  | ) |

This method enable the program

## ◆ validate()

void GLSLProgram::validate | ( | void |  | ) |

This method validates that the program was generated successfully

## Member Data Documentation

## ◆ _fragmentSource

std::string GLSLProgram::_fragmentSource
| private

## ◆ _handle

GLuint GLSLProgram::_handle
| private

## ◆ _linked

bool GLSLProgram::_linked
| private

## ◆ _vertexSource

std::string GLSLProgram::_vertexSource
| private

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

- Assignments/Ray/GLSLProgram.h
- Assignments/Ray/GLSLProgram.cpp