mirror of
https://github.com/memononen/nanovg
synced 2026-09-26 16:19:07 +03:00
Implemented OGL 3.2 core profile back-end
- moved demo stuff to separate file - created two separate examples for gl2 and gl3 - initial stab at OGL 3.2 core profile back-end (currently twice as slows as 2.0) - API change: glBeginFrame() takes view witdth and height as input - added FPS counter to demo
This commit is contained in:
parent
714d18a4c6
commit
9b00b7aaf5
10 changed files with 1305 additions and 186 deletions
|
|
@ -17,12 +17,14 @@ The NanoVG API is modeled loosely on HTML5 canvas API. If you know canvas, you'r
|
|||
|
||||
## Creating drawing context
|
||||
|
||||
The drawing context is created using platform specific constructor function. If you're using the default OpenGL back-end the context is created as follows:
|
||||
The drawing context is created using platform specific constructor function. If you're using the default OpenGL 2.0 back-end the context is created as follows:
|
||||
```C
|
||||
struct NVGcontext* vg = glnvgCreate(512, 512);
|
||||
struct NVGcontext* vg = nvgCreateGL2(512, 512);
|
||||
```
|
||||
The two values passed to the constructor define the size of the texture atlas used for text rendering, 512x512 is a good starting point. If you're rendering retina sized text or plan to use a lot of different fonts, 1024x1024 is better choice.
|
||||
|
||||
Currently there are two different back-ends for NanoVG: [nanovg_gl2.h](/src/nanovg_gl2.h) for OpenGL 2.0 and [nanovg_gl3.h](/src/nanovg_gl3.h) for OpenGL 3.2 core profile.
|
||||
|
||||
## Drawing shapes with NanoVG
|
||||
|
||||
Drawing a simple shape using NanoVG consists of four steps: 1) begin a new shape, 2) define the path to draw, 3) set fill or stroke, 4) and finally fill or stroke the path.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue