Skip to content

Commit

Permalink
Fix glad on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozaq committed Jan 16, 2024
1 parent 92c0f17 commit 6325e3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jps-ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ target_link_libraries(jps-ui

target_compile_definitions(jps-ui PUBLIC
GL_SILENCE_DEPRECATION
GLFW_INCLUDE_GLCOREARB
GLFW_INCLUDE_NONE
)

10 changes: 7 additions & 3 deletions jps-ui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "shader.hpp"
#include "wkt.hpp"

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <geos_c.h>
#include <glad/glad.h>
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/vec3.hpp>
#include <imgui.h>
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
Expand Down

0 comments on commit 6325e3c

Please sign in to comment.