[nostalgia] Setup Glad as GL loader

This commit is contained in:
Gary Talent 2022-07-10 02:46:26 -05:00
parent e7ecb65f7a
commit c80a8838a4
3 changed files with 5 additions and 9 deletions

View File

@ -2,9 +2,9 @@
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/ */
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <nostalgia/core/config.hpp>
#include <nostalgia/core/gfx.hpp> #include <nostalgia/core/gfx.hpp>
#include <nostalgia/core/input.hpp> #include <nostalgia/core/input.hpp>
#include <nostalgia/core/userland/gfx.hpp> #include <nostalgia/core/userland/gfx.hpp>

View File

@ -2,6 +2,7 @@
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved. * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/ */
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <imgui_impl_glfw.h> #include <imgui_impl_glfw.h>
@ -109,6 +110,9 @@ ox::Error initGfx(Context *ctx) noexcept {
glfwSetKeyCallback(id->window, handleGlfwKeyEvent); glfwSetKeyCallback(id->window, handleGlfwKeyEvent);
glfwSetWindowUserPointer(id->window, ctx); glfwSetWindowUserPointer(id->window, ctx);
glfwMakeContextCurrent(id->window); glfwMakeContextCurrent(id->window);
if (!gladLoadGLES2Loader(reinterpret_cast<GLADloadproc>(glfwGetProcAddress))) {
return OxError(2, "Could not init Glad");
}
if constexpr(config::ImGuiEnabled) { if constexpr(config::ImGuiEnabled) {
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();
ImGui::CreateContext(); ImGui::CreateContext();

View File

@ -6,15 +6,7 @@
#include <ox/std/defines.hpp> #include <ox/std/defines.hpp>
#define GL_GLEXT_PROTOTYPES 1
#ifdef OX_OS_Darwin
#ifndef GL_SILENCE_DEPRECATION
#define GL_SILENCE_DEPRECATION
#endif
#include <OpenGL/gl3.h>
#else
#include <glad/glad.h> #include <glad/glad.h>
#endif
#include <ox/std/error.hpp> #include <ox/std/error.hpp>
#include <ox/std/string.hpp> #include <ox/std/string.hpp>