Browse Source

Merge pull request #4 from andrewcorrigan/master

fix for https://github.com/memononen/nanovg/issues/3
shared-context
Mikko Mononen 11 years ago
parent
commit
aeefcd1c2f
2 changed files with 11 additions and 1 deletions
  1. +9
    -0
      example/example.c
  2. +2
    -1
      premake4.lua

+ 9
- 0
example/example.c View File

@@ -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) {


+ 2
- 1
premake4.lua View File

@@ -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" }


Loading…
Cancel
Save