-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.h
More file actions
47 lines (42 loc) · 1.4 KB
/
Program.h
File metadata and controls
47 lines (42 loc) · 1.4 KB
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
#ifndef _PROGRAM_H_
#define _PROGRAM_H_
#include <GL/glew.h>
#include <glfw3.h>
#include <GL/freeglut.h>
#include "OpenGLInit.h"
#include "Population.h"
namespace EvoLisa {
class Program {
GLFWwindow *window;
ShaderProgram shaderProgram;
Population population;
GLuint VAO, VBO, FBO, text;
public:
unsigned char *original;
int iter;
Program ();
void Init () {
iter = 0;
original = SOIL_load_image ("mona-200.bmp", &Tools::width, &Tools::height, 0, SOIL_LOAD_RGB);
Tools::WIND_HEIGHT = Tools::height;
Tools::WIND_WIDTH = Tools::width;
Tools::Elitism = (int)ceil (population.Size * 0.75);
InitOpenGL (window, Tools::WIND_WIDTH, Tools::WIND_HEIGHT, 3, 3);
shaderProgram = ShaderProgram ("ImageShader.vert", "ImageShader.frag");
glGenVertexArrays (1, &VAO);
glGenBuffers (1, &VBO);
glGenTextures (1, &text);
glBindTexture (GL_TEXTURE_2D, text);
//glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, Tools::WIND_WIDTH , Tools::WIND_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glBindTexture (GL_TEXTURE_2D, 0);
glGenFramebuffers (1, &FBO);
glBindFramebuffer (GL_FRAMEBUFFER, FBO);
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, text, 0);
glBindFramebuffer (GL_FRAMEBUFFER, 0);
}
void Run ();
};
}
#endif