diff options
author | rtk0c <[email protected]> | 2021-03-28 15:13:05 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-03-28 15:31:35 -0700 |
commit | a7e5e42a188f9e6ab13706a15e6b50f36f0e00e8 (patch) | |
tree | 61545e68e1186be3900303ded6d12086c345af3f /core/src/Entrypoint/OpenGL3.cpp | |
parent | bdcc81822adddf2c6ad7f10d9e090d913475c1e0 (diff) |
Fix backend compiling/loading mechanism
Diffstat (limited to 'core/src/Entrypoint/OpenGL3.cpp')
-rw-r--r-- | core/src/Entrypoint/OpenGL3.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/core/src/Entrypoint/OpenGL3.cpp b/core/src/Entrypoint/OpenGL3.cpp index c1f66d5..7d5cae1 100644 --- a/core/src/Entrypoint/OpenGL3.cpp +++ b/core/src/Entrypoint/OpenGL3.cpp @@ -1,15 +1,17 @@ #include "OpenGL3.hpp" -#include <glad/glad.h> +#if BUILD_CORE_WITH_OPENGL3_BACKEND +# include <glad/glad.h> +# include <GLFW/glfw3.h> +# include <backend/imgui_impl_glfw.h> +# include <backend/imgui_impl_opengl3.h> +# include <imgui.h> +# include <stdexcept> -#include <GLFW/glfw3.h> -#include <backend/imgui_impl_glfw.h> -#include <backend/imgui_impl_opengl3.h> -#include <imgui.h> -#include <stdexcept> +# define IMGUI_IMPL_OPENGL_LOADER_GLAD +# include <backend/imgui_impl_opengl3.cpp> OpenGL3Backend::OpenGL3Backend() { -#if IMGUI_INCLUDE_OPENGL3_BACKEND glfwSetErrorCallback(GlfwErrorCallback); if (!glfwInit()) { throw std::runtime_error("Failed to initialize GLFW."); @@ -47,9 +49,6 @@ OpenGL3Backend::OpenGL3Backend() { ImGui_ImplGlfw_InitForOpenGL(mWindow, true); ImGui_ImplOpenGL3_Init(glslVersion); -#else - throw std::runtime_error("Backend opengl3 is not available in this build.\n"); -#endif } OpenGL3Backend::~OpenGL3Backend() { @@ -83,3 +82,21 @@ void OpenGL3Backend::EndFrame() { glfwSwapBuffers(mWindow); } + +#else // ^^ BUILD_CORE_WITH_OPENGL3_BACKEND | !BUILD_CORE_WITH_OPENGL3_BACKEND vv +# include <stdexcept> + +OpenGL3Backend::OpenGL3Backend() { + throw std::runtime_error("Backend opengl3 is not available in this build.\n"); +} + +OpenGL3Backend::~OpenGL3Backend() { +} + +void OpenGL3Backend::BeginFrame() { +} + +void OpenGL3Backend::EndFrame() { +} + +#endif |