-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
55 lines (44 loc) · 1.31 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
#include "glfwConfig.h"
#include "imguiConfig.h"
#include "occtWindow.h"
#include "occView.h"
#include "configs.h"
//#include "mainMenuBar.h"
int main(int, char**)
{
slab::initFlgw();
Handle(GlfwOcctWindow) glfwOcctWindow = new GlfwOcctWindow(kWindow_width, kWindow_height,kWindow_name);
GlfwOcctView *glfwOcctView = new GlfwOcctView(glfwOcctWindow);
if(glfwOcctView != nullptr)
glfwOcctView->run();
GLFWwindow* window = glfwOcctWindow->getGlfwWindow();
if (window == nullptr)
return 1;
slab::initImgui(window);
//ui::MainMenuBar *mainMenuBar = new ui::MainMenuBar;
// 主循环
while (!glfwWindowShouldClose(window))
{
// 模式
glfwPollEvents();
// 新建帧
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// 窗口组件
slab::imguiRun();
glfwOcctView->refrash();
//mainMenuBar->render();
// 渲染
ImGui::Render();
// 清除
glClear(GL_COLOR_BUFFER_BIT);
glfwOcctView->getView()->Redraw(); // 清除完颜色缓冲区后再渲染一次occt,否则会黑屏
// 缓冲区交换
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
}
// imgui清除
slab::imguiClear();
return 0;
}