SleakEngine 0.1.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::RenderEngine::OpenGLShader Class Reference

GLSL shader program compiled from either a combined source file or separate vertex/fragment files. More...

#include <OpenGLShader.hpp>

Inheritance diagram for Sleak::RenderEngine::OpenGLShader:

Public Member Functions

 OpenGLShader ()
 OpenGLShader (const OpenGLShader &)=delete
 ~OpenGLShader () override
void bind () override
 Binds this program as the active shader for subsequent draws.
bool compile (const std::string &shaderPath) override
 Splits a combined shader file into vertex/fragment stages and links them.
bool compile (const std::string &vert, const std::string &frag) override
 Compiles and links separate vertex and fragment shader files.
GLuint GetProgram () const
const std::string & GetStem () const
 Returns the stem of the vertex source, e.g. gbuffer for gbuffer_gl.vert.
OpenGLShader & operator= (const OpenGLShader &)=delete
bool Reload ()
 Rebuilds the program from its files, keeping the old one on failure.
bool UsesStem (const std::string &stem) const
 Returns true when the vertex or fragment source has the given stem.
Public Member Functions inherited from Sleak::RenderEngine::Shader
virtual ~Shader ()=default

Detailed Description

GLSL shader program compiled from either a combined source file or separate vertex/fragment files.

Definition at line 17 of file OpenGLShader.hpp.

Constructor & Destructor Documentation

◆ OpenGLShader() [1/2]

Sleak::RenderEngine::OpenGLShader::OpenGLShader ( )

Definition at line 52 of file OpenGLShader.cpp.

◆ ~OpenGLShader()

Sleak::RenderEngine::OpenGLShader::~OpenGLShader ( )
override

Definition at line 58 of file OpenGLShader.cpp.

◆ OpenGLShader() [2/2]

Sleak::RenderEngine::OpenGLShader::OpenGLShader ( const OpenGLShader & )
delete

Member Function Documentation

◆ bind()

void Sleak::RenderEngine::OpenGLShader::bind ( )
overridevirtual

Binds this program as the active shader for subsequent draws.

Implements Sleak::RenderEngine::Shader.

Definition at line 144 of file OpenGLShader.cpp.

◆ compile() [1/2]

bool Sleak::RenderEngine::OpenGLShader::compile ( const std::string & shaderPath)
overridevirtual

Splits a combined shader file into vertex/fragment stages and links them.

Implements Sleak::RenderEngine::Shader.

Definition at line 74 of file OpenGLShader.cpp.

◆ compile() [2/2]

bool Sleak::RenderEngine::OpenGLShader::compile ( const std::string & vert,
const std::string & frag )
overridevirtual

Compiles and links separate vertex and fragment shader files.

Implements Sleak::RenderEngine::Shader.

Definition at line 84 of file OpenGLShader.cpp.

◆ GetProgram()

GLuint Sleak::RenderEngine::OpenGLShader::GetProgram ( ) const
inline

Definition at line 30 of file OpenGLShader.hpp.

◆ GetStem()

const std::string & Sleak::RenderEngine::OpenGLShader::GetStem ( ) const
inline

Returns the stem of the vertex source, e.g. gbuffer for gbuffer_gl.vert.

Definition at line 35 of file OpenGLShader.hpp.

◆ operator=()

OpenGLShader & Sleak::RenderEngine::OpenGLShader::operator= ( const OpenGLShader & )
delete

◆ Reload()

bool Sleak::RenderEngine::OpenGLShader::Reload ( )

Rebuilds the program from its files, keeping the old one on failure.

Definition at line 93 of file OpenGLShader.cpp.

◆ UsesStem()

bool Sleak::RenderEngine::OpenGLShader::UsesStem ( const std::string & stem) const
inline

Returns true when the vertex or fragment source has the given stem.

Definition at line 37 of file OpenGLShader.hpp.