Update SDL example for OS X
Just like GLFW example, use different settings in Makefile and different shader versions.
This commit is contained in:
parent
a8d124adf1
commit
8ca1c35608
|
@ -15,7 +15,12 @@ ifeq ($(OS),Windows_NT)
|
||||||
BIN := $(BIN).exe
|
BIN := $(BIN).exe
|
||||||
LIBS = -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lm -lGLU32 -lGLEW32
|
LIBS = -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lm -lGLU32 -lGLEW32
|
||||||
else
|
else
|
||||||
LIBS = -lSDL2 -lGL -lm -lGLU -lGLEW
|
UNAME_S := $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
LIBS = -lSDL2 -framework OpenGL -lm -lGLEW
|
||||||
|
else
|
||||||
|
LIBS = -lSDL2 -lGL -lm -lGLU -lGLEW
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Modes
|
# Modes
|
||||||
|
|
|
@ -27,12 +27,17 @@ static struct nk_sdl {
|
||||||
struct nk_font_atlas atlas;
|
struct nk_font_atlas atlas;
|
||||||
} sdl;
|
} sdl;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define NK_SHADER_VERSION "#version 150\n"
|
||||||
|
#else
|
||||||
|
#define NK_SHADER_VERSION "#version 300 es\n"
|
||||||
|
#endif
|
||||||
NK_API void
|
NK_API void
|
||||||
nk_sdl_device_create(void)
|
nk_sdl_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"
|
||||||
|
@ -45,7 +50,7 @@ nk_sdl_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"
|
||||||
|
|
Loading…
Reference in New Issue