Shader is a class representing a shader in OpenGL. It handles the creation, loading, and compilation of shaders from files, including vertex, fragment, tessellation control, tessellation evaluation, and geometry shaders. It provides functionality to retrieve the shader ID and its source code.
More...
#include <Shader.h>
|
| Shader () |
| Default constructor for Shader. Initializes shader ID to 0, shader code to an empty string, and type to VERTEX.
|
|
| Shader (int pId, std::string pFile, ShaderType pShaderType) |
| Constructor for Shader with provided ID, file name, and shader type.
|
|
| ~Shader () |
| Destructor for Shader. Cleans up any allocated resources.
|
|
int | GetID () const |
| Gets the shader ID.
|
|
ShaderType | GetType () const |
| Gets the shader type.
|
|
void | Load (std::string pFileName, ShaderType pShaderType) |
| Loads the shader code from the specified file and sets the shader type.
|
|
std::string & | GetCode () |
| Gets the shader code. (contents of the text file)
|
|
|
static const std::string | SHADER_PATH = "Resources/Shaders/" |
| The path to the shader files. Feel free to adjust if needed.
|
|
|
unsigned int | mId |
| The OpenGL shader ID.
|
|
std::string | mCode |
| The source code of the shader.
|
|
ShaderType | mType |
| The type of the shader (vertex, fragment, etc.).
|
|
Shader is a class representing a shader in OpenGL. It handles the creation, loading, and compilation of shaders from files, including vertex, fragment, tessellation control, tessellation evaluation, and geometry shaders. It provides functionality to retrieve the shader ID and its source code.
◆ Shader() [1/2]
Default constructor for Shader. Initializes shader ID to 0, shader code to an empty string, and type to VERTEX.
◆ Shader() [2/2]
Shader::Shader |
( |
int | pId, |
|
|
std::string | pFile, |
|
|
ShaderType | pShaderType ) |
Constructor for Shader with provided ID, file name, and shader type.
- Parameters
-
pId | The ID of the shader. |
pFile | The source code of the shader in string format. |
pShaderType | The type of the shader (e.g., vertex, fragment). |
◆ ~Shader()
Destructor for Shader. Cleans up any allocated resources.
◆ GetCode()
std::string & Shader::GetCode |
( |
| ) |
|
Gets the shader code. (contents of the text file)
- Returns
- A reference to the shader source code.
◆ GetID()
int Shader::GetID |
( |
| ) |
const |
Gets the shader ID.
- Returns
- The ID of the shader.
◆ GetType()
Gets the shader type.
- Returns
- The type of the shader.
◆ Load()
void Shader::Load |
( |
std::string | pFileName, |
|
|
ShaderType | pShaderType ) |
Loads the shader code from the specified file and sets the shader type.
- Parameters
-
pFileName | The name of the shader file to load. |
pShaderType | The type of the shader (e.g., vertex, fragment). |
◆ mCode
std::string Shader::mCode |
|
protected |
The source code of the shader.
◆ mId
◆ mType
The type of the shader (vertex, fragment, etc.).
◆ SHADER_PATH
const std::string Shader::SHADER_PATH = "Resources/Shaders/" |
|
static |
The path to the shader files. Feel free to adjust if needed.
The documentation for this class was generated from the following files: