]> granicus.if.org Git - graphviz/commitdiff
add an OpenGL abstraction header
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 24 Mar 2022 04:18:20 +0000 (21:18 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 29 Mar 2022 23:43:45 +0000 (16:43 -0700)
On macOS, the OpenGL implementation is provided by the XCode SDK under the
“OpenGL/” prefix instead of “GL/” as on other operating systems. Note that
glut.h is still provided by the Freeglut package under “GL/”.

Gitlab: related to #1836, #1854

12 files changed:
cmd/smyrna/gltemplate.h
cmd/smyrna/selectionfuncs.h
cmd/smyrna/smyrnadefs.h
lib/glcomp/CMakeLists.txt
lib/glcomp/Makefile.am
lib/glcomp/glcomp.vcxproj
lib/glcomp/glcomp.vcxproj.filters
lib/glcomp/glcompdefs.h
lib/glcomp/glcompfont.h
lib/glcomp/glcomptexture.h
lib/glcomp/glutils.h
lib/glcomp/opengl.h [new file with mode: 0644]

index e0a30c91056a5448f2c8e8183b655ae8ec293b33..f8468e2ff8b254070810be810dd002523c281d7a 100644 (file)
@@ -19,8 +19,7 @@
 #ifdef _WIN32
 #include <windows.h>
 #endif
-#include <GL/gl.h>
-#include <GL/glu.h>
+#include <glcomp/opengl.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtkgl.h>
index 60b3311acdaba3185e565131bf0af6dd31eb9e52..1dac0494c68abba4489439ac13d86ea6d2007021 100644 (file)
@@ -11,7 +11,7 @@
 #pragma once
 
 #include "draw.h"
-#include <GL/gl.h>
+#include <glcomp/opengl.h>
 
 extern void pick_objects_rect(Agraph_t* g) ;
 extern void deselect_all(Agraph_t* g);
index 29b5d773452c906110ca453863961fafa172c7b7..9f2c1d7e316bb1a33ff7aa13ed1da6d09b358016 100644 (file)
@@ -18,8 +18,7 @@
 
 #include <xdot/xdot.h>
 #include <gtk/gtk.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
+#include <glcomp/opengl.h>
 #include <gtk/gtkgl.h>
 #include <cgraph/cgraph.h>
 #include <glcomp/glcompset.h>
index 4e221618d89e73b296b755d87fa41972d4525e24..31ab74f9ab41cff7a9f4d7951a0901cf4f40f6a2 100644 (file)
@@ -22,6 +22,7 @@ if(with_smyrna)
     glcomptexture.h
     glpangofont.h
     glutils.h
+    opengl.h
 
     glcompbutton.c
     glcompfont.c
index 7097483fbaad58cea2b0b50d0f5cea2e47c9f872..447fb653f2f913bd7755677cabd39e6a7112640f 100644 (file)
@@ -9,7 +9,7 @@ if WITH_SMYRNA
 noinst_HEADERS = glcompbutton.h glcompdefs.h glcomplabel.h \
        glcomppanel.h glcompset.h glcomptexture.h \
        glpangofont.h glcomptextpng.h glcompfont.h glcompmouse.h \
-       glutils.h glcompimage.h
+       glutils.h glcompimage.h opengl.h
 
 noinst_LTLIBRARIES = libglcomp_C.la
 endif
index 35e5bf2f82675aa70506802fa7a65e1503551a08..ec6e28e81e2e07c3bec0e438ce9d4928c1fde1cc 100644 (file)
@@ -85,6 +85,7 @@
     <ClInclude Include="glcomptrackbar.h" />
     <ClInclude Include="glpangofont.h" />
     <ClInclude Include="glutils.h" />
+    <ClInclude Include="opengl.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="glcompbutton.c" />
index 5c7027bd141fd36245f3e9be7b7e300695881f18..488d0a5669826adf95cab94158e0621dcaf5e598 100644 (file)
@@ -45,6 +45,9 @@
     <ClInclude Include="glutils.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="opengl.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="glcompbutton.c">
index 1425fe9023ddbbad6aebd8a93cd919c241c3131a..9ec0926e7491a02146254c7b4b88e0e1e571ac5c 100644 (file)
@@ -20,8 +20,7 @@
 #include <winuser.h>
 #include <tchar.h>
 #endif
-#include <GL/gl.h>
-#include <GL/glu.h>
+#include <glcomp/opengl.h>
 
 #ifdef __cplusplus
 extern "C" {
index ee794e7f99aa3f7cf4760403a574e579431f40e7..a5824106df93f25f9177b15153fbc7cdbb328cc4 100644 (file)
@@ -17,8 +17,8 @@
 typedef float GLfloat;
 #else
 #include <unistd.h>
-#include <GL/gl.h>
 #endif
+#include <glcomp/opengl.h>
 #include <glcomp/glcompdefs.h>
 #include <GL/glut.h>
 
index 8b940b153ad27eb55f1e3386ed98582d0df91851..79096a78d2250be95740b1ba324e8b0ccbd0588c 100644 (file)
@@ -18,8 +18,7 @@
 #include "windows.h"
 #endif
 #include <stdio.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
+#include <glcomp/opengl.h>
 #include <glcomp/glcompdefs.h>
 
 #ifdef __cplusplus
index e75a5563484aa2840adecec6b3f2e8e51ebd5b6b..e9420ab79dbcf2c9590267b0a1aa960bbe4e38e0 100644 (file)
@@ -13,8 +13,7 @@
 #ifdef _WIN32
 #include "windows.h"
 #endif
-#include <GL/gl.h>
-#include <GL/glu.h>
+#include <glcomp/opengl.h>
 #include <glcomp/glcompdefs.h>
 
 #ifdef __cplusplus
diff --git a/lib/glcomp/opengl.h b/lib/glcomp/opengl.h
new file mode 100644 (file)
index 0000000..66003ea
--- /dev/null
@@ -0,0 +1,16 @@
+// shim to deal with OpenGL headers being at a different path on macOS
+
+#pragma once
+
+// OpenGL headers on Windows use the `WINGDIAPI` macro
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
+#include <GL/gl.h>
+#include <GL/glu.h>
+#endif