Merge branch 'fdb-osx-support'

This commit is contained in:
vurtun 2016-04-19 11:18:44 +02:00
commit acbe50caee
3 changed files with 21 additions and 5 deletions

View File

@ -15,7 +15,12 @@ ifeq ($(OS),Windows_NT)
BIN := $(BIN).exe
LIBS = -lglfw3 -lopengl32 -lm -lGLU32 -lGLEW32
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
# Modes

View File

@ -9,8 +9,13 @@
#include <math.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>
/* these defines are both needed for the header

View File

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