-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScreen_Stream.h
54 lines (38 loc) · 1.15 KB
/
Screen_Stream.h
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
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef MANDELBROT_FRACTAL_DRAWER_DRAW_BUFFER_H
#define MANDELBROT_FRACTAL_DRAWER_DRAW_BUFFER_H
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "Get_GL.h"
#include "Pixel_Stream_Base.h"
#include "RGB.h"
#include <memory>
class Screen_Stream : public Pixel_Stream_Base {
// Pointer to glfw screen
GLFWwindow *screen;
// Texture where pixels are written to
GLuint mandelbrot_tex;
// GLSL Shader program
GLuint shader_prog;
// Vertex shader
GLuint vertex_shader;
// Fragment shader
GLuint frag_shader;
// VAO
GLuint vao;
// Element buffer object
GLuint ebo;
// Vertex buffer object
GLuint vbo;
// Util function to compile shader
static void compile_shader(GLuint &shader, const std::string &src);
void generate_shaders(const std::string&, const std::string&);
public:
Screen_Stream(std::shared_ptr<Bounds2D<int>> &, const std::string &, const std::string &);
virtual ~Screen_Stream() override;
void make_current() {
glfwMakeContextCurrent(screen);
}
virtual void flush() override;
};
#endif //MANDELBROT_FRACTAL_DRAWER_DRAW_BUFFER_H