-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglfw_opengl3.cppm
More file actions
129 lines (101 loc) · 3.01 KB
/
glfw_opengl3.cppm
File metadata and controls
129 lines (101 loc) · 3.01 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
export module imgui.backend.glfw_opengl3;
export import imgui.core;
export import imgui.backend.glfw;
export import imgui.backend.opengl3;
export namespace ImGui::Backend::GlfwOpenGL3 {
using Monitor = Glfw::Monitor;
using Window = Glfw::Window;
bool InitGlfw() {
return Glfw::InitGlfw();
}
void TerminateGlfw() {
Glfw::TerminateGlfw();
}
const char* GlfwVersionString() {
return Glfw::GlfwVersionString();
}
int GetError(const char** description) {
return Glfw::GetError(description);
}
void DefaultWindowHints() {
Glfw::DefaultWindowHints();
}
void ConfigureOpenGL(int major, int minor, bool coreProfile = true, bool forwardCompat = false) {
Glfw::ConfigureOpenGL(major, minor, coreProfile, forwardCompat);
}
void SetNextWindowVisible(bool visible) {
Glfw::SetNextWindowVisible(visible);
}
Window* CreateWindow(
int width,
int height,
const char* title,
Monitor* monitor = nullptr,
Window* share = nullptr
) {
return Glfw::CreateWindow(width, height, title, monitor, share);
}
void DestroyWindow(Window* window) {
Glfw::DestroyWindow(window);
}
void MakeContextCurrent(Window* window) {
Glfw::MakeContextCurrent(window);
}
void SwapInterval(int interval) {
Glfw::SwapInterval(interval);
}
bool WindowShouldClose(Window* window) {
return Glfw::WindowShouldClose(window);
}
void SetWindowShouldClose(Window* window, bool value) {
Glfw::SetWindowShouldClose(window, value);
}
void PollEvents() {
Glfw::PollEvents();
}
void SwapBuffers(Window* window) {
Glfw::SwapBuffers(window);
}
bool InitForOpenGL(Window* window, bool installCallbacks = true) {
return Glfw::InitForOpenGL(window, installCallbacks);
}
bool InitRenderer(const char* glslVersion = nullptr) {
return OpenGL3::Init(glslVersion);
}
bool Init(Window* window, const char* glslVersion = nullptr, bool installCallbacks = true) {
if (!InitForOpenGL(window, installCallbacks)) {
return false;
}
if (!InitRenderer(glslVersion)) {
Glfw::Shutdown();
return false;
}
return true;
}
void ShutdownRenderer() {
OpenGL3::Shutdown();
}
void ShutdownPlatform() {
Glfw::Shutdown();
}
void Shutdown() {
ShutdownRenderer();
ShutdownPlatform();
}
void NewFrame() {
OpenGL3::NewFrame();
Glfw::NewFrame();
}
void RenderDrawData(ImDrawData* drawData) {
OpenGL3::RenderDrawData(drawData);
}
void InstallCallbacks(Window* window) {
Glfw::InstallCallbacks(window);
}
void RestoreCallbacks(Window* window) {
Glfw::RestoreCallbacks(window);
}
void SetCallbacksChainForAllWindows(bool chainForAllWindows) {
Glfw::SetCallbacksChainForAllWindows(chainForAllWindows);
}
}