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