Browse Source

Merge pull request #358 from JamalLyons/fix/opengl-headers-macos-compatibility

Fix OpenGL header compatibility for macOS builds
Adam Djellouli 1 month ago
parent
commit
32f030308d

+ 1 - 1
render/gl/backend.cpp

@@ -17,11 +17,11 @@
 #include "ground/plant_gpu.h"
 #include "ground/stone_gpu.h"
 #include "mesh.h"
+#include "opengl_headers.h"
 #include "render_constants.h"
 #include "shader.h"
 #include "state_scopes.h"
 #include "texture.h"
-#include <GL/gl.h>
 #include <QDebug>
 #include <cmath>
 #include <cstddef>

+ 1 - 1
render/gl/backend/cylinder_pipeline.cpp

@@ -4,7 +4,7 @@
 #include "../primitives.h"
 #include "../render_constants.h"
 #include "gl/shader_cache.h"
-#include <GL/gl.h>
+#include "../opengl_headers.h"
 #include <algorithm>
 #include <cstddef>
 #include <qopenglext.h>

+ 1 - 1
render/gl/backend/terrain_pipeline.cpp

@@ -2,7 +2,7 @@
 #include "../backend.h"
 #include "../render_constants.h"
 #include "../shader_cache.h"
-#include <GL/gl.h>
+#include "../opengl_headers.h"
 #include <QDebug>
 #include <QOpenGLExtraFunctions>
 #include <cstddef>

+ 1 - 1
render/gl/backend/vegetation_pipeline.cpp

@@ -1,7 +1,7 @@
 #include "vegetation_pipeline.h"
 #include "../render_constants.h"
 #include "gl/shader_cache.h"
-#include <GL/gl.h>
+#include "../opengl_headers.h"
 #include <QDebug>
 #include <cmath>
 #include <cstddef>

+ 1 - 1
render/gl/buffer.cpp

@@ -1,5 +1,5 @@
 #include "buffer.h"
-#include <GL/gl.h>
+#include "opengl_headers.h"
 #include <cstddef>
 #include <qopenglext.h>
 #include <vector>

+ 1 - 1
render/gl/mesh.cpp

@@ -1,7 +1,7 @@
 #include "mesh.h"
 #include "gl/buffer.h"
 #include "render_constants.h"
-#include <GL/gl.h>
+#include "opengl_headers.h"
 #include <QOpenGLFunctions_3_3_Core>
 #include <memory>
 #include <vector>

+ 10 - 0
render/gl/opengl_headers.h

@@ -0,0 +1,10 @@
+#pragma once
+
+// Platform-specific OpenGL header inclusion
+#ifdef __APPLE__
+    #include <OpenGL/gl.h>
+    #include <OpenGL/glu.h>
+#else
+    #include <GL/gl.h>
+    #include <GL/glu.h>
+#endif

+ 1 - 1
render/gl/resources.cpp

@@ -2,7 +2,7 @@
 #include "gl/mesh.h"
 #include "gl/texture.h"
 #include "render_constants.h"
-#include <GL/gl.h>
+#include "opengl_headers.h"
 #include <QVector3D>
 #include <cmath>
 #include <memory>

+ 1 - 1
render/gl/shader.cpp

@@ -1,7 +1,7 @@
 #include "shader.h"
 #include "render_constants.h"
 #include "utils/resource_utils.h"
-#include <GL/gl.h>
+#include "opengl_headers.h"
 #include <QByteArray>
 #include <QDebug>
 #include <QFile>

+ 1 - 1
render/gl/texture.cpp

@@ -1,5 +1,5 @@
 #include "texture.h"
-#include <GL/gl.h>
+#include "opengl_headers.h"
 #include <QDebug>
 #include <QImage>
 #include <qglobal.h>