Make examples work on OS X
All examples use GLFW, so we update the Makefile, remove OpenGL include headers (GLFW will include them automatically) and conditionally set a different shader version.
This commit is contained in:
parent
8ca1c35608
commit
da9899c618
@ -8,7 +8,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
|
||||
|
||||
all: node_editor file_browser overview extended
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
@ -32,6 +30,12 @@
|
||||
#define MAX_ELEMENT_MEMORY 128 * 1024
|
||||
#define UNUSED(a) (void)a
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define NK_SHADER_VERSION "#version 150\n"
|
||||
#else
|
||||
#define NK_SHADER_VERSION "#version 300 es\n"
|
||||
#endif
|
||||
|
||||
/* ===============================================================
|
||||
*
|
||||
* DEVICE
|
||||
@ -52,12 +56,13 @@ struct device {
|
||||
GLuint font_tex;
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
device_init(struct device *dev)
|
||||
{
|
||||
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"
|
||||
@ -70,7 +75,7 @@ device_init(struct device *dev)
|
||||
" 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"
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
@ -39,6 +37,12 @@
|
||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define NK_SHADER_VERSION "#version 150\n"
|
||||
#else
|
||||
#define NK_SHADER_VERSION "#version 300 es\n"
|
||||
#endif
|
||||
|
||||
struct icons {
|
||||
struct nk_image unchecked;
|
||||
struct nk_image checked;
|
||||
@ -521,7 +525,7 @@ device_init(struct device *dev)
|
||||
{
|
||||
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"
|
||||
@ -534,7 +538,7 @@ device_init(struct device *dev)
|
||||
" 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"
|
||||
|
@ -9,10 +9,10 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
@ -39,6 +39,12 @@
|
||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define NK_SHADER_VERSION "#version 150\n"
|
||||
#else
|
||||
#define NK_SHADER_VERSION "#version 300 es\n"
|
||||
#endif
|
||||
|
||||
/* ===============================================================
|
||||
*
|
||||
* GUI
|
||||
@ -548,7 +554,7 @@ device_init(struct device *dev)
|
||||
{
|
||||
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"
|
||||
@ -561,7 +567,7 @@ device_init(struct device *dev)
|
||||
" 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"
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
@ -47,6 +45,12 @@
|
||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define NK_SHADER_VERSION "#version 150\n"
|
||||
#else
|
||||
#define NK_SHADER_VERSION "#version 300 es\n"
|
||||
#endif
|
||||
|
||||
/* ===============================================================
|
||||
*
|
||||
* NODE EDITOR
|
||||
@ -402,7 +406,7 @@ device_init(struct device *dev)
|
||||
{
|
||||
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"
|
||||
@ -415,7 +419,7 @@ device_init(struct device *dev)
|
||||
" 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"
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include <limits.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
@ -36,6 +34,12 @@
|
||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#define LEN(a) (sizeof(a)/sizeof(a)[0])
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define NK_SHADER_VERSION "#version 150\n"
|
||||
#else
|
||||
#define NK_SHADER_VERSION "#version 300 es\n"
|
||||
#endif
|
||||
|
||||
/* ===============================================================
|
||||
*
|
||||
* GUI
|
||||
@ -1154,7 +1158,7 @@ device_init(struct device *dev)
|
||||
{
|
||||
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"
|
||||
@ -1167,7 +1171,7 @@ device_init(struct device *dev)
|
||||
" 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