SimpleGL  1.1.0
A framework for platform independent rendering
Public Member Functions | List of all members
sgl::ShaderProgram Class Reference

This class wraps an OpenGL shader program. More...

#include <shader_objects.hpp>

Public Member Functions

 ShaderProgram (void)
 Creates a new shader program. More...
 
 ~ShaderProgram (void)
 Deletes the shader program. More...
 
GLuint getHandle ()
 Returns the handle of the shader program. More...
 
void attach (Shader *shader)
 Attaches a shader object to the shader program. More...
 
void link ()
 Links the shader program. More...
 
void use ()
 Uses the shader program for the current rendering state. More...
 
bool getLinkStatus ()
 Checks the link status of the shader program. More...
 
std::string getInfoLog ()
 Gets the info log of the shader program. More...
 
void bindFragmentDataLocation (unsigned int colorNumber, std::string name)
 Binds the fragment out color variable. More...
 
int getAttributeLocation (std::string name)
 Gets the location of an attribute variable with specified name. More...
 
int getUniformLocation (std::string name)
 Gets the location of an uniform variable with specified name. More...
 
void setUniform (int location, int value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, float value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, glm::vec2 value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, glm::vec3 value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, glm::vec4 value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, glm::mat2 value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, glm::mat3 value)
 Sets the value of an uniform variable. More...
 
void setUniform (int location, glm::mat4 value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, int value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, float value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, glm::vec2 value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, glm::vec3 value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, glm::vec4 value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, glm::mat2 value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, glm::mat3 value)
 Sets the value of an uniform variable. More...
 
void setUniform (std::string name, glm::mat4 value)
 Sets the value of an uniform variable. More...
 

Detailed Description

This class wraps an OpenGL shader program.

Definition at line 93 of file shader_objects.hpp.

Constructor & Destructor Documentation

sgl::ShaderProgram::ShaderProgram ( void  )

Creates a new shader program.

Definition at line 58 of file shader_objects.cpp.

sgl::ShaderProgram::~ShaderProgram ( void  )

Deletes the shader program.

Definition at line 62 of file shader_objects.cpp.

Member Function Documentation

void sgl::ShaderProgram::attach ( Shader shader)

Attaches a shader object to the shader program.

Parameters
shaderThe shader object to attach.

Definition at line 75 of file shader_objects.cpp.

void sgl::ShaderProgram::bindFragmentDataLocation ( unsigned int  colorNumber,
std::string  name 
)

Binds the fragment out color variable.

Parameters
colorNumberThe color number to bind.
nameName of the out variable.

Definition at line 108 of file shader_objects.cpp.

int sgl::ShaderProgram::getAttributeLocation ( std::string  name)

Gets the location of an attribute variable with specified name.

Parameters
nameThe name of the attribute variable.
Returns
The location of the attribute variable.

Definition at line 112 of file shader_objects.cpp.

GLuint sgl::ShaderProgram::getHandle ( )

Returns the handle of the shader program.

Returns
The handle of the shader program.

Definition at line 71 of file shader_objects.cpp.

std::string sgl::ShaderProgram::getInfoLog ( )

Gets the info log of the shader program.

Returns
Information log of the shader program.

Definition at line 100 of file shader_objects.cpp.

bool sgl::ShaderProgram::getLinkStatus ( )

Checks the link status of the shader program.

Returns
true if the linking was successful, else false.

Definition at line 94 of file shader_objects.cpp.

int sgl::ShaderProgram::getUniformLocation ( std::string  name)

Gets the location of an uniform variable with specified name.

Parameters
nameThe name of the uniform variable.
Returns
The location of the uniform variable.

Definition at line 116 of file shader_objects.cpp.

void sgl::ShaderProgram::link ( )

Links the shader program.

Definition at line 79 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
int  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 120 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
float  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 124 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
glm::vec2  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 128 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
glm::vec3  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 132 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
glm::vec4  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 136 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
glm::mat2  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 140 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
glm::mat3  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 144 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( int  location,
glm::mat4  value 
)

Sets the value of an uniform variable.

Parameters
locationThe location of the uniform variable.
valueThe value to be used.

Definition at line 148 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
int  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 152 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
float  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 157 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
glm::vec2  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 162 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
glm::vec3  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 167 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
glm::vec4  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 172 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
glm::mat2  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 177 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
glm::mat3  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 182 of file shader_objects.cpp.

void sgl::ShaderProgram::setUniform ( std::string  name,
glm::mat4  value 
)

Sets the value of an uniform variable.

Parameters
nameThe name of the uniform variable.
valueThe value to be used.

Definition at line 187 of file shader_objects.cpp.

void sgl::ShaderProgram::use ( )

Uses the shader program for the current rendering state.

Definition at line 83 of file shader_objects.cpp.


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