Support OS X for the GLFW demo.
Use conditionals to support the appropriate includes and shader versions needed for OS X.
This commit is contained in:
parent
9b2822c06e
commit
5b0b4c9ffd
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user