Open DigitalPilgrim opened 7 years ago
I recommend to take a look at the GLFW tutorials first on how to set up an OpenGL window. Then it should be pretty straight forward to setup the NanoVG context.
Note, you cannot create it globally like in your example. You have to have OpenGL initialized first, just like in the examples.
I read this tutorial and run GLFW successful, problem is when I try only include nanovg with or without code:
#define NANOVG_GL2_IMPLEMENTATION
#include <nanovg.h>
#include <nanovg_gl.h>
btw. on main site is written only
#include <glfw3.h>
#define NANOVG_GL2_IMPLEMENTATION
#include <nanovg_gl.h>
without nanovg.h. If it isn't there, compiler get this error:
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(59): error C2143: syntax error: missing ';' before '*'
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(60): error C2065: 'ctx': undeclared identifier
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(60): error C2182: 'nvgDeleteGL2': illegal use of type 'void'
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(62): error C2065: 'ctx': undeclared identifier
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(62): error C2275: 'GLuint': illegal use of this type as an expression
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\GL/gl.h(57): note: see declaration of 'GLuint'
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(62): error C2146: syntax error: missing ')' before identifier 'textureId'
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(63): error C2065: 'ctx': undeclared identifier
1>D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(63): error C2062: type 'int' unexpected
1>d:\programi\development\nanovg\nanovg-master2\src\nanovg.h(33): error C2378: 'NVGcontext': redefinition; symbol cannot be overloaded with a typedef
1> D:\Programi\Development\NanoVG\nanovg-master2\src\nanovg_gl.h(59): note: see declaration of 'NVGcontext'
// ... long list
and only nanovg.h only compiler errors:
1>Source.obj : error LNK2001: unresolved external symbol _nvgBeginPath
1>Source.obj : error LNK2001: unresolved external symbol _nvgFillColor
1>Source.obj : error LNK2001: unresolved external symbol _nvgFill
1>Source.obj : error LNK2001: unresolved external symbol _nvgRect
1>Source.obj : error LNK2001: unresolved external symbol _nvgRGBA
1>D:\...\GLFW test\Release\GLFW a NVG.exe : fatal error LNK1120: 5 unresolved externals
Ok, you are right. I have not properly installed opengl. I need glew with glfw to use NanoVG. Now, I am going to study opengl and NanoVG :)
Hello
I want try NanoVG as UI for my applications. I am new in OpenGL and have trouble with run NanoVG with GLFW.
here is my code
compiler fail and here is error list:
Glfw sample code (without nanovg included) compile without any issue. What is right set up for running nanovg?