SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
OpenGLShader.hpp
Go to the documentation of this file.
1
#ifndef OPENGLSHADER_HPP_
2
#define OPENGLSHADER_HPP_
3
4
#include "
../Common/Shader.hpp
"
5
#include <glad/glad.h>
6
7
namespace
Sleak
{
8
namespace
RenderEngine
{
9
10
/// GLSL shader program compiled from either a combined source file or separate vertex/fragment files.
11
class
ENGINE_API
OpenGLShader
:
public
Shader
{
12
public
:
13
OpenGLShader
();
14
~OpenGLShader
()
override
;
15
16
/// Splits a combined shader file into vertex/fragment stages and links them.
17
bool
compile
(
const
std::string& shaderPath)
override
;
18
/// Compiles and links separate vertex and fragment shader files.
19
bool
compile
(
const
std::string& vert,
const
std::string& frag)
override
;
20
void
bind
()
override
;
21
22
GLuint
GetProgram
()
const
{
return
m_program; }
23
24
private
:
25
/// Compiles a single shader stage from source text.
26
bool
CompileShaderSource(
const
std::string& source, GLenum type,
27
GLuint& shader);
28
std::string ReadFile(
const
std::string& path);
29
30
GLuint m_program = 0;
31
};
32
33
}
// namespace RenderEngine
34
}
// namespace Sleak
35
36
#endif
// OPENGLSHADER_HPP_
Shader.hpp
Sleak::RenderEngine::OpenGLShader::OpenGLShader
OpenGLShader()
Definition
OpenGLShader.cpp:9
Sleak::RenderEngine::OpenGLShader::GetProgram
GLuint GetProgram() const
Definition
OpenGLShader.hpp:22
Sleak::RenderEngine::OpenGLShader::bind
void bind() override
Binds this program as the active shader for subsequent draws.
Definition
OpenGLShader.cpp:73
Sleak::RenderEngine::OpenGLShader::compile
bool compile(const std::string &shaderPath) override
Splits a combined shader file into vertex/fragment stages and links them.
Definition
OpenGLShader.cpp:18
Sleak::RenderEngine::Shader
Backend-agnostic compiled shader program.
Definition
Shader.hpp:11
Sleak::RenderEngine
Backend-facing rendering layer shared by the four graphics backends.
Definition
Application.hpp:60
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
include
private
Graphics
OpenGL
OpenGLShader.hpp
Generated on
for SleakEngine by
1.18.0