From 1dd4cf01049dcb0218a2072ac20ead193a1dbb1c Mon Sep 17 00:00:00 2001 From: Andrew Corrigan Date: Sun, 2 Feb 2014 20:23:55 +0800 Subject: [PATCH] uses GLEW with Linux to avoid issues with glUniform1f, explicitly links glfw3 and C math library --- example/example.c | 9 +++++++++ premake4.lua | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/example/example.c b/example/example.c index f62332d..b2e88c3 100644 --- a/example/example.c +++ b/example/example.c @@ -20,6 +20,9 @@ #include #include #include +#ifdef NANOVG_GLEW +# include +#endif #include #include "nanovg.h" #define GLNANOVG_IMPLEMENTATION @@ -743,6 +746,12 @@ int main() glfwSetKeyCallback(window, key); glfwMakeContextCurrent(window); +#ifdef NANOVG_GLEW + if(glewInit() != GLEW_OK) { + printf("Could not init glew.\n"); + return -1; + } +#endif vg = glnvgCreate(512,512); if (vg == NULL) { diff --git a/premake4.lua b/premake4.lua index 23a24f0..6c64757 100644 --- a/premake4.lua +++ b/premake4.lua @@ -14,7 +14,8 @@ solution "nanovg" targetdir("build") configuration { "linux" } - links { "X11","Xrandr", "rt", "GL", "GLU", "pthread" } + links { "X11","Xrandr", "rt", "GL", "GLU", "pthread","m","glfw3","GLEW" } + defines { "NANOVG_GLEW" } configuration { "windows" } links { "glu32","opengl32", "gdi32", "winmm", "user32" }