-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
59 lines (46 loc) · 1.56 KB
/
main.cpp
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
55
56
57
58
59
#include <list>
#include "imgui.h"
#include "VAO.hpp"
#include "VBO.hpp"
#include "util/color.hpp"
#include "views/cube.hpp"
#include "views/triangle.hpp"
#include "window.hpp"
#include "shaders.hpp"
#include "instance_drawer.hpp"
#include "instance.hpp"
#include "gui.hpp"
#include "wrappers/gl.hpp"
#include "wrappers/glfw.hpp"
#include "entt/entity/registry.hpp"
static float mdx = 0, mdy = 0;
/***
*
ImGui::Text("Mouse: %f %f", posx, posy);
ImGui::Text("Window: %f %f",
m_viewport_window.pos.x, m_viewport_window.pos.y);
ImGui::Text("MouseWindow: %f %f",
posx - m_viewport_window.pos.x, posy - m_viewport_window.pos.y);
*/
int main() {
printf("TT_TT my take on OpenGL Engines\n");
GLFWwindow *w = initGLFW();
GUI gui(w);
glfwSetWindowUserPointer(w, &gui);
glfwSetFramebufferSizeCallback(w, [](GLFWwindow *w, int width, int height) {
GUI *s = (GUI *)glfwGetWindowUserPointer(w) ;
glViewport(0, 0, width, height);
s->m_viewport_window.m_scene.cam.update(s->m_viewport_window.size.x, s->m_viewport_window.size.y);
Program::setMat4_id(Shaders::get_shader("main"), "vp", s->m_viewport_window.m_scene.cam.matrix);
// TODO: vector with all the shaders that need updating to batch the process
// of inserting vp matrix
});
while (!glfwWindowShouldClose(w)){
Color clear_color("#202020");
glClearColor(clear_color.r, clear_color.g, clear_color.b, clear_color.a); // clear
glClear(gl::Bits::color_buffer | gl::Bits::depth_buffer);
gui_render(gui);
glfwSwapBuffers(w);
glfwPollEvents();
}
}