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-2026 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 <cstdint>
7#include <memory>
8
10namespace jngl {
11
13class Shader {
14public:
16 enum class Type : uint8_t {
17 VERTEX,
18 FRAGMENT,
19 };
20
29 Shader(const char* source, Type, const char* gles20Source = nullptr);
30
36 Shader(const std::istream& source, Type);
37 Shader(const std::istream& source, Type, const std::istream& gles20Source); //< \overload
38
39 ~Shader();
40 Shader(const Shader&) = delete;
41 Shader(Shader&&) noexcept;
42 Shader& operator=(const Shader&) = delete;
43 Shader& operator=(Shader&&) noexcept;
44
45private:
46 struct Impl;
47 std::unique_ptr<Impl> impl;
48
49 friend class ShaderProgram;
50};
51
52} // namespace jngl
Linked vertex and fragment shaders.
Fragment or vertex GLSL shader.
Definition Shader.hpp:13
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:16
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.