Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL includes for macOS < 10.7: there is no gl3.h in the SDK #173

Open
barracuda156 opened this issue Jan 3, 2024 · 1 comment
Open

Comments

@barracuda156
Copy link

The following code cannot possibly work for macOS < 10.7 where OpenGL framework does not contain gl3.h:

# ifdef __APPLE__
#define GL_SILENCE_DEPRECATION
#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
# include <OpenGL/gl3.h>
# include <OpenGL/glu.h>
# else
# include <GL/gl.h>
# include <GL/glu.h>
# endif

Do we actually need GL 3? If yes, then the fallback should be generic (in a hope a user has installed libX11 with its headers). If no, then gl.h should be used.

@barracuda156
Copy link
Author

That is, provided GL 3 is not required, this should work:

--- libsrc/include/incopengl.hpp	2023-12-23 05:42:55.000000000 +0800
+++ libsrc/include/incopengl.hpp	2024-01-04 00:51:24.000000000 +0800
@@ -5,16 +5,20 @@
 #include <mystdlib.h>
 #include <mydefs.hpp>
 
-#  ifdef __APPLE__
-#define GL_SILENCE_DEPRECATION
-#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+#ifdef __APPLE__
+#  include <AvailabilityMacros.h>
+#  define GL_SILENCE_DEPRECATION
+#  define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+#  if MAC_OS_X_VERSION_MIN_REQUIRED > 1060
 #    include <OpenGL/gl3.h>
-#    include <OpenGL/glu.h>
 #  else
-#    include <GL/gl.h>
-#    include <GL/glu.h>
+#    include <OpenGL/gl.h>
 #  endif
-
+#  include <OpenGL/glu.h>
+#else
+#  include <GL/gl.h>
+#  include <GL/glu.h>
+#endif
 
 #ifdef TOGL_X11
 // parallel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant