fix for https://github.com/memononen/nanovg/issues/3shared-context
@@ -20,6 +20,9 @@ | |||||
#include <string.h> | #include <string.h> | ||||
#include <iconv.h> | #include <iconv.h> | ||||
#include <math.h> | #include <math.h> | ||||
#ifdef NANOVG_GLEW | |||||
# include <GL/glew.h> | |||||
#endif | |||||
#include <GLFW/glfw3.h> | #include <GLFW/glfw3.h> | ||||
#include "nanovg.h" | #include "nanovg.h" | ||||
#define GLNANOVG_IMPLEMENTATION | #define GLNANOVG_IMPLEMENTATION | ||||
@@ -743,6 +746,12 @@ int main() | |||||
glfwSetKeyCallback(window, key); | glfwSetKeyCallback(window, key); | ||||
glfwMakeContextCurrent(window); | glfwMakeContextCurrent(window); | ||||
#ifdef NANOVG_GLEW | |||||
if(glewInit() != GLEW_OK) { | |||||
printf("Could not init glew.\n"); | |||||
return -1; | |||||
} | |||||
#endif | |||||
vg = glnvgCreate(512,512); | vg = glnvgCreate(512,512); | ||||
if (vg == NULL) { | if (vg == NULL) { | ||||
@@ -14,7 +14,8 @@ solution "nanovg" | |||||
targetdir("build") | targetdir("build") | ||||
configuration { "linux" } | configuration { "linux" } | ||||
links { "X11","Xrandr", "rt", "GL", "GLU", "pthread" } | |||||
links { "X11","Xrandr", "rt", "GL", "GLU", "pthread","m","glfw3","GLEW" } | |||||
defines { "NANOVG_GLEW" } | |||||
configuration { "windows" } | configuration { "windows" } | ||||
links { "glu32","opengl32", "gdi32", "winmm", "user32" } | links { "glu32","opengl32", "gdi32", "winmm", "user32" } | ||||