Эх сурвалжийг харах

Merge branch 'fdb-osx-support'

vurtun 9 жил өмнө
parent
commit
acbe50caee

+ 6 - 1
demo/glfw/Makefile

@@ -15,7 +15,12 @@ ifeq ($(OS),Windows_NT)
 BIN := $(BIN).exe
 BIN := $(BIN).exe
 LIBS = -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32
 LIBS = -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32
 else
 else
-LIBS = -lglfw -lGL -lm -lGLU -lGLEW
+	UNAME_S := $(shell uname -s)
+	ifeq ($(UNAME_S),Darwin)
+		LIBS = -lglfw3 -framework OpenGL -lm -lGLEW
+	else
+    LIBS = -lglfw -lGL -lm -lGLU -lGLEW
+	endif
 endif
 endif
 
 
 # Modes
 # Modes

+ 7 - 2
demo/glfw/main.c

@@ -9,8 +9,13 @@
 #include <math.h>
 #include <math.h>
 
 
 #include <GL/glew.h>
 #include <GL/glew.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
+#ifdef __APPLE__
+    #include <OpenGL/gl.h>
+    #include <OpenGL/glu.h>
+#else
+    #include <GL/gl.h>
+    #include <GL/glu.h>
+#endif
 #include <GLFW/glfw3.h>
 #include <GLFW/glfw3.h>
 
 
 /* these defines are both needed for the header
 /* these defines are both needed for the header

+ 8 - 2
demo/glfw/nuklear_glfw.c

@@ -30,12 +30,18 @@ static struct nk_glfw {
     float scroll;
     float scroll;
 } glfw;
 } glfw;
 
 
+#ifdef __APPLE__
+  #define NK_SHADER_VERSION "#version 400\n"
+#else
+  #define NK_SHADER_VERSION "#version 300 es\n"
+#endif
+
 NK_API void
 NK_API void
 nk_glfw3_device_create(void)
 nk_glfw3_device_create(void)
 {
 {
     GLint status;
     GLint status;
     static const GLchar *vertex_shader =
     static const GLchar *vertex_shader =
-        "#version 300 es\n"
+        NK_SHADER_VERSION
         "uniform mat4 ProjMtx;\n"
         "uniform mat4 ProjMtx;\n"
         "in vec2 Position;\n"
         "in vec2 Position;\n"
         "in vec2 TexCoord;\n"
         "in vec2 TexCoord;\n"
@@ -48,7 +54,7 @@ nk_glfw3_device_create(void)
         "   gl_Position = ProjMtx * vec4(Position.xy, 0, 1);\n"
         "   gl_Position = ProjMtx * vec4(Position.xy, 0, 1);\n"
         "}\n";
         "}\n";
     static const GLchar *fragment_shader =
     static const GLchar *fragment_shader =
-        "#version 300 es\n"
+        NK_SHADER_VERSION
         "precision mediump float;\n"
         "precision mediump float;\n"
         "uniform sampler2D Texture;\n"
         "uniform sampler2D Texture;\n"
         "in vec2 Frag_UV;\n"
         "in vec2 Frag_UV;\n"