From 6325e3cc35f3224d6d9afcbf60bc4d3600eb692c Mon Sep 17 00:00:00 2001 From: Ozaq Date: Tue, 16 Jan 2024 16:18:05 +0100 Subject: [PATCH] Fix glad on macos --- jps-ui/CMakeLists.txt | 2 +- jps-ui/src/main.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jps-ui/CMakeLists.txt b/jps-ui/CMakeLists.txt index 540774ed4..4949b3200 100644 --- a/jps-ui/CMakeLists.txt +++ b/jps-ui/CMakeLists.txt @@ -25,6 +25,6 @@ target_link_libraries(jps-ui target_compile_definitions(jps-ui PUBLIC GL_SILENCE_DEPRECATION - GLFW_INCLUDE_GLCOREARB + GLFW_INCLUDE_NONE ) diff --git a/jps-ui/src/main.cpp b/jps-ui/src/main.cpp index 6c5639a50..593a8f749 100644 --- a/jps-ui/src/main.cpp +++ b/jps-ui/src/main.cpp @@ -5,9 +5,9 @@ #include "shader.hpp" #include "wkt.hpp" -#include #include #include +#include #include #include #include @@ -79,9 +79,11 @@ int main(int argc, char** argv) /* Create a windowed mode window and its OpenGL context */ const char* glsl_version = "#version 150"; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only +#ifdef __APPLE__ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); +#endif window = glfwCreateWindow(640, 480, "Mesh Viewer", NULL, NULL); if(!window) { @@ -91,7 +93,9 @@ int main(int argc, char** argv) /* Make the window's context current */ glfwMakeContextCurrent(window); - gladLoadGL(); + if(!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) { + return -1; + } glfwSwapInterval(1); IMGUI_CHECKVERSION();