-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
73 lines (59 loc) · 1.93 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
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <cstdlib>
#include <jdbc/mysql_driver.h>
#include <jdbc/mysql_connection.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <fstream>
#include <sstream>
using namespace std;
using namespace ImGui;
using namespace cv;
using namespace sql;
int main(int, char**) {
if (!glfwInit()) return 1;
const char* glsl_version = "#version 130";
GLFWwindow* window = glfwCreateWindow(1280, 720, "projectName", nullptr, nullptr);
if (window == nullptr) return 1;
glfwMakeContextCurrent(window);
if (glewInit() != GLEW_OK) return 1;
glfwSwapInterval(1);
IMGUI_CHECKVERSION();
CreateContext();
ImGuiIO& io = GetIO(); (void)io;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init(glsl_version);
ImVec4 clear_color = ImVec4(0.047f, 0.110f, 0.145f, 1.0f);
while (!glfwWindowShouldClose(window)){
glfwPollEvents();
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
NewFrame();
Begin("Window");
End();
Render();
int display_w, display_h;
glfwGetFramebufferSize(window, &display_w, &display_h);
glViewport(0, 0, display_w, display_h);
glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(GetDrawData());
glfwSwapBuffers(window);
}
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
DestroyContext();
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}