aboutsummaryrefslogtreecommitdiff
path: root/include/RenderBackend/OpenGL/ShaderProgram.hpp
blob: f1fea00eeb218156a5aebc98c0dad64970bb765d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "../../Result.hpp"
#include "../../types.hpp"
#include "../../utils.hpp"
#include "../../Vec.hpp"
#include "Uniform.hpp"
#include "DeviceMemory.hpp"

#include <vector>
#include <memory>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

namespace amalgine {
    class Shader;

    class ShaderProgram
    {
        DISABLE_COPY(ShaderProgram)
    public:
        ~ShaderProgram();
        static Result<std::unique_ptr<ShaderProgram>> build(const std::vector<Shader*> &shaders);

        Result<Uniform> get_uniform_by_name(const char *name);
        int set_vertex_input(const char *name, const DeviceMemory &data);

        void use();
    private:
        ShaderProgram(u32 shader_program_id);
    private:
        u32 program_id;
    };
}