JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Shader.hpp
Go to the documentation of this file.
1// Copyright 2018-2024 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
4#pragma once
5
6#include <memory>
7
9namespace jngl {
10
12class Shader {
13public:
15 enum class Type : uint8_t {
16 VERTEX,
17 FRAGMENT,
18 };
19
23 Shader(const char* source, Type, const char* gles20Source = nullptr);
24
30 Shader(const std::istream& source, Type);
31 Shader(const std::istream& source, Type, const std::istream& gles20Source); //< \overload
32
33 ~Shader();
34 Shader(const Shader&) = delete;
35 Shader(Shader&&) = delete;
36 Shader& operator=(const Shader&) = delete;
37 Shader& operator=(Shader&&) = delete;
38
39private:
40 struct Impl;
42
43 friend class ShaderProgram;
44};
45
46} // namespace jngl
Linked vertex and fragment shaders.
Fragment or vertex GLSL shader.
Definition Shader.hpp:12
Shader(const char *source, Type, const char *gles20Source=nullptr)
Creates a vertex or fragment shader by compiling it.
Type
Type of a Shader. To link a ShaderProgram, one shader of each type is needed.
Definition Shader.hpp:15
Shader(const std::istream &source, Type)
This is an overloaded member function, provided for convenience. It differs from the above function o...
JNGL's main namespace.