فهرست منبع

remove glad includes and loaders

Alec Jacobson 3 سال پیش
والد
کامیت
37d04e7683
3فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 4 0
      include/igl/opengl/gl.h
  2. 2 0
      include/igl/opengl/glfw/Viewer.cpp
  3. 2 0
      include/igl/opengl/glfw/background_window.cpp

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

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

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

@@ -177,11 +177,13 @@ namespace glfw
     }
     }
     glfwMakeContextCurrent(window);
     glfwMakeContextCurrent(window);
     // Load OpenGL and its extensions
     // Load OpenGL and its extensions
+#ifndef __APPLE__
     if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
     if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
     {
     {
       printf("Failed to load OpenGL and its extensions\n");
       printf("Failed to load OpenGL and its extensions\n");
       return(-1);
       return(-1);
     }
     }
+#endif
     #if defined(DEBUG) || defined(_DEBUG)
     #if defined(DEBUG) || defined(_DEBUG)
       printf("OpenGL Version %d.%d loaded\n", GLVersion.major, GLVersion.minor);
       printf("OpenGL Version %d.%d loaded\n", GLVersion.major, GLVersion.minor);
       int major, minor, rev;
       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);
   window = glfwCreateWindow(1, 1,"", NULL, NULL);
   if(!window) return false;
   if(!window) return false;
   glfwMakeContextCurrent(window);
   glfwMakeContextCurrent(window);
+#ifndef __APPLE__
   if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
   if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
   {
   {
     printf("Failed to load OpenGL and its extensions");
     printf("Failed to load OpenGL and its extensions");
   }
   }
+#endif
   glGetError(); // pull and safely ignore unhandled errors like GL_INVALID_ENUM
   glGetError(); // pull and safely ignore unhandled errors like GL_INVALID_ENUM
   return true;
   return true;
 }
 }