Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::Shader Class Reference

Represents an OpenGL shader object. More...

#include <Shader.h>

Public Member Functions

 Shader ()
 Default constructor. Initializes with default values.
 
 Shader (int pID, std::string pCode, ShaderType pShaderType, bool pPath=true)
 Constructs a shader with the given parameters and loads it.
 
 ~Shader ()
 Destructor. Cleans up the shader object.
 
int GetID ()
 Gets the OpenGL shader ID.
 
void Load (std::string pFileName, ShaderType pShaderType, bool pPath=true)
 Loads the shader from a file or source code.
 
void Use ()
 Activates the shader for use.
 
const std::string GetCode () const
 Gets the shader source code.
 

Protected Attributes

GLuint mID
 
std::string mCode
 
ShaderType mType
 

Detailed Description

Represents an OpenGL shader object.

Constructor & Destructor Documentation

◆ Shader()

clt::Shader::Shader ( int pID,
std::string pCode,
ShaderType pShaderType,
bool pPath = true )
inline

Constructs a shader with the given parameters and loads it.

Parameters
pIDShader ID.
pCodeShader source code or file path.
pShaderTypeType of the shader.
pPathIf true, pCode is treated as a file path; otherwise, as source code.

Member Function Documentation

◆ GetCode()

const std::string clt::Shader::GetCode ( ) const
inline

Gets the shader source code.

Returns
The shader source code.

◆ GetID()

int clt::Shader::GetID ( )
inline

Gets the OpenGL shader ID.

Returns
The shader ID.

◆ Load()

void Shader::Load ( std::string pFileName,
ShaderType pShaderType,
bool pPath = true )

Loads the shader from a file or source code.

Parameters
pFileNameFile name or source code.
pShaderTypeType of the shader.
pPathIf true, pFileName is treated as a file path; otherwise, as source code.

Member Data Documentation

◆ mCode

std::string clt::Shader::mCode
protected

Shader source code

◆ mID

GLuint clt::Shader::mID
protected

OpenGL shader ID

◆ mType

ShaderType clt::Shader::mType
protected

Type of the shader


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