SGCT
master (487fac4)
Simple Graphics Cluster Toolkit
Toggle main menu visibility
Loading...
Searching...
No Matches
shaderprogram.h
Go to the documentation of this file.
1
/*****************************************************************************************
2
* SGCT *
3
* Simple Graphics Cluster Toolkit *
4
* *
5
* Copyright (c) 2012-2026 *
6
* For conditions of distribution and use, see copyright notice in LICENSE.md *
7
****************************************************************************************/
8
9
#ifndef __SGCT__SHADERPROGRAM__H__
10
#define __SGCT__SHADERPROGRAM__H__
11
12
#include <sgct/sgctexports.h>
13
14
#include <string>
15
#include <string_view>
16
#include <vector>
17
18
namespace
sgct
{
19
24
class
SGCT_EXPORT
ShaderProgram
{
25
public
:
26
ShaderProgram
() =
default
;
27
35
ShaderProgram
(std::string
name
);
36
ShaderProgram
(
const
ShaderProgram
&) =
delete
;
37
ShaderProgram
(
ShaderProgram
&&) noexcept;
38
ShaderProgram
& operator=(const
ShaderProgram
&) = delete;
39
ShaderProgram
& operator=(
ShaderProgram
&&) noexcept;
40
46
~
ShaderProgram
();
47
51
void
deleteProgram
();
52
60
void
addVertexShader
(std::string_view src);
61
69
void
addFragmentShader
(std::string_view src);
70
76
void
createAndLinkProgram
();
77
81
void
bind
() const;
82
86
static
void
unbind
();
87
91
std::string_view
name
() const;
92
96
unsigned
int
id
() const;
97
98
private:
102
void
createProgram();
103
105
std::
string
_name;
107
unsigned
int
_programId = 0;
108
109
std::vector<
unsigned
int
> _shaders;
110
};
111
112
}
// namespace sgct
113
114
#endif
// __SGCT__SHADERPROGRAM__H__
sgct::ShaderProgram::unbind
static void unbind()
Unset the shader program in the current rendering pipeline.
sgct::ShaderProgram::ShaderProgram
ShaderProgram(std::string name)
Default only sets the program name.
sgct::ShaderProgram::addFragmentShader
void addFragmentShader(std::string_view src)
Will create and add a fragment shader to the program.
sgct::ShaderProgram::addVertexShader
void addVertexShader(std::string_view src)
Will create and add a vertex shader to the program.
sgct::ShaderProgram::ShaderProgram
ShaderProgram()=default
sgct::ShaderProgram::ShaderProgram
ShaderProgram(ShaderProgram &&) noexcept
sgct::ShaderProgram::createAndLinkProgram
void createAndLinkProgram()
Will create the program and link the shaders.
sgct::ShaderProgram::bind
void bind() const
Use the shader program in the current rendering pipeline.
sgct::ShaderProgram::name
std::string_view name() const
sgct::ShaderProgram::deleteProgram
void deleteProgram()
Will detach all attached shaders, delete them and then delete the program.
sgct::ShaderProgram::ShaderProgram
ShaderProgram(const ShaderProgram &)=delete
sgct
Definition
actions.h:16
sgct
shaderprogram.h
Generated by
1.18.0