JNGL
Main Page
Namespaces
Classes
Files
File List
File Members
jngl
ShaderProgram.hpp
Go to the documentation of this file.
1
// Copyright 2018-2020 Jan Niklas Hasse <
[email protected]
>
2
// For conditions of distribution and use, see copyright notice in LICENSE.txt
5
#pragma once
6
7
#include "
Finally.hpp
"
8
9
#include <
memory
>
10
#include <
string
>
11
12
namespace
jngl
{
13
14
class
Shader;
15
17
class
ShaderProgram
{
18
public
:
19
ShaderProgram
(
const
Shader
& vertex,
const
Shader
& fragment);
20
~
ShaderProgram
();
21
ShaderProgram
(
const
ShaderProgram
&) =
delete
;
22
ShaderProgram
(
ShaderProgram
&&) =
delete
;
23
ShaderProgram
& operator=(
const
ShaderProgram
&) =
delete
;
24
ShaderProgram
& operator=(
ShaderProgram
&&) =
delete
;
25
26
struct
Impl;
28
struct
Context
{
29
explicit
Context
(
const
Impl&);
30
~
Context
();
31
Context
(
const
Context
&) =
delete
;
32
Context
& operator=(
const
Context
&) =
delete
;
33
Context
(
Context
&&) noexcept;
34
Context
& operator=(
Context
&&) =
delete
;
35
36
static
void
setUniform(
int
location,
int
v0);
37
static
void
setUniform(
int
location,
float
v0,
float
v1);
38
static
void
setUniform(
int
location,
float
v0,
float
v1,
float
v2,
float
v3);
39
40
private
:
41
static
int
referenceCount;
42
static
const
Impl* activeImpl;
43
};
44
45
#if __cplusplus >= 201703L
46
[[nodiscard]]
47
#endif
48
Context
49
use()
const
;
50
51
[[nodiscard]]
int
getAttribLocation(
const
std::string
& name)
const
;
52
[[nodiscard]]
int
getUniformLocation(
const
std::string
& name)
const
;
53
54
private
:
55
std::unique_ptr<Impl>
impl;
56
};
57
58
void
setUniform(
int
location,
float
v0,
float
v1);
59
60
}
// namespace jngl
Finally.hpp
Contains jngl::Finally class.
std::string
jngl::ShaderProgram
Linked vertex and fragment shaders.
Definition:
ShaderProgram.hpp:17
jngl::Shader
Fragment or vertex GLSL shader.
Definition:
Shader.hpp:12
memory
jngl
JNGL's main namespace.
Definition:
App.hpp:10
string
jngl::ShaderProgram::Context
Lifetime object when the ShaderProgram is in use.
Definition:
ShaderProgram.hpp:28
std::unique_ptr< Impl >