summaryrefslogtreecommitdiff
path: root/Canvas/Canvas.h
blob: ee6c8448c235a71ac1c15d3e6777fd9aa140ec95 (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
35
36
37
38
39
40
41
42
//
// Created by saintruler on 04.05.19.
//

#ifndef OPENGLTEST_CANVAS_H
#define OPENGLTEST_CANVAS_H

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <shader.h>
#include <Point.h>
#include "gpu/CalculateCanvas.h"

#include <iostream>

struct Color
{
    unsigned int r = 0, g = 0, b = 0;
};

class Canvas
{
public:
    Canvas(int width, int height, Point* points, int nPoints);

    void SetPixel(int x, int y, Color color);
    void UpdateTexture();
    void DrawTexture();
    void DeleteCanvas();

private:
    int width, height, nPoints;
    unsigned char* canvas;
    unsigned int texture;
    Point* points;

    unsigned int VBO, VAO, EBO;

    Shader shader = Shader("4.1.texture.vs", "4.1.texture.fs");
};

#endif //OPENGLTEST_CANVAS_H