summaryrefslogtreecommitdiff
path: root/core/src/Entrypoint/OpenGL2.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2021-03-28 15:13:05 -0700
committerrtk0c <[email protected]>2021-03-28 15:31:35 -0700
commita7e5e42a188f9e6ab13706a15e6b50f36f0e00e8 (patch)
tree61545e68e1186be3900303ded6d12086c345af3f /core/src/Entrypoint/OpenGL2.cpp
parentbdcc81822adddf2c6ad7f10d9e090d913475c1e0 (diff)
Fix backend compiling/loading mechanism
Diffstat (limited to 'core/src/Entrypoint/OpenGL2.cpp')
-rw-r--r--core/src/Entrypoint/OpenGL2.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/core/src/Entrypoint/OpenGL2.cpp b/core/src/Entrypoint/OpenGL2.cpp
index de13a02..216399e 100644
--- a/core/src/Entrypoint/OpenGL2.cpp
+++ b/core/src/Entrypoint/OpenGL2.cpp
@@ -1,15 +1,17 @@
#include "OpenGL2.hpp"
-#include <glad/glad.h>
+#if BUILD_CORE_WITH_OPENGL2_BACKEND
+# include <glad/glad.h>
+# include <GLFW/glfw3.h>
+# include <backend/imgui_impl_glfw.h>
+# include <backend/imgui_impl_opengl2.h>
+# include <imgui.h>
+# include <stdexcept>
-#include <GLFW/glfw3.h>
-#include <backend/imgui_impl_glfw.h>
-#include <backend/imgui_impl_opengl2.h>
-#include <imgui.h>
-#include <stdexcept>
+# define IMGUI_IMPL_OPENGL_LOADER_GLAD
+# include <backend/imgui_impl_opengl2.cpp>
OpenGL2Backend::OpenGL2Backend() {
-#if IMGUI_INCLUDE_OPENGL2_BACKEND
glfwSetErrorCallback(GlfwErrorCallback);
if (!glfwInit()) {
throw std::runtime_error("Failed to initialize GLFW.");
@@ -31,9 +33,6 @@ OpenGL2Backend::OpenGL2Backend() {
ImGui_ImplGlfw_InitForOpenGL(mWindow, true);
ImGui_ImplOpenGL2_Init();
-#else
- throw std::runtime_error("Backend opengl2 is not available in this build.\n");
-#endif
}
OpenGL2Backend::~OpenGL2Backend() {
@@ -68,3 +67,21 @@ void OpenGL2Backend::EndFrame() {
glfwMakeContextCurrent(mWindow);
glfwSwapBuffers(mWindow);
}
+
+#else // ^^ BUILD_CORE_WITH_OPENGL2_BACKEND | !BUILD_CORE_WITH_OPENGL2_BACKEND vv
+# include <stdexcept>
+
+OpenGL2Backend::OpenGL2Backend() {
+ throw std::runtime_error("Backend opengl2 is not available in this build.\n");
+}
+
+OpenGL2Backend::~OpenGL2Backend() {
+}
+
+void OpenGL2Backend::BeginFrame() {
+}
+
+void OpenGL2Backend::EndFrame() {
+}
+
+#endif