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
24 Shader(const char* source, Type, const char* gles20Source = nullptr);
25
31 Shader(const std::istream& source, Type);
32 Shader(const std::istream& source, Type, const std::istream& gles20Source); //< \overload
33
34 ~Shader();
35 Shader(const Shader&) = delete;
36 Shader(Shader&&) noexcept;
37 Shader& operator=(const Shader&) = delete;
38 Shader& operator=(Shader&&) noexcept;
39
40private:
41 struct Impl;
42 std::unique_ptr<Impl> impl;
43
44 friend class ShaderProgram;
45};
46
47} // 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.