Browse Source

remove glad includes and loaders

Alec Jacobson 3 years ago
parent
commit
37d04e7683

+ 4 - 0
include/igl/opengl/gl.h

@@ -20,6 +20,10 @@
 //     #include <GL/gl.h>
 //
 
+#ifdef __APPLE__
+#include <OpenGL/gl3.h>
+#else
 #include <glad/glad.h>
+#endif
 
 #endif

+ 2 - 0
include/igl/opengl/glfw/Viewer.cpp

@@ -177,11 +177,13 @@ namespace glfw
     }
     glfwMakeContextCurrent(window);
     // Load OpenGL and its extensions
+#ifndef __APPLE__
     if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
     {
       printf("Failed to load OpenGL and its extensions\n");
       return(-1);
     }
+#endif
     #if defined(DEBUG) || defined(_DEBUG)
       printf("OpenGL Version %d.%d loaded\n", GLVersion.major, GLVersion.minor);
       int major, minor, rev;

+ 2 - 0
include/igl/opengl/glfw/background_window.cpp

@@ -17,10 +17,12 @@ IGL_INLINE bool igl::opengl::glfw::background_window(GLFWwindow* & window)
   window = glfwCreateWindow(1, 1,"", NULL, NULL);
   if(!window) return false;
   glfwMakeContextCurrent(window);
+#ifndef __APPLE__
   if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
   {
     printf("Failed to load OpenGL and its extensions");
   }
+#endif
   glGetError(); // pull and safely ignore unhandled errors like GL_INVALID_ENUM
   return true;
 }