@@ 21,10 21,25 @@
#include <assert.h>
#include <nanovg.h>
-#define NANOVG_GL3_IMPLEMENTATION
+#include <GL/glew.h>
+#define NANOVG_GL2_IMPLEMENTATION
#include <GL/gl.h>
#include <nanovg_gl.h>
+#if defined(NANOVG_GL2_IMPLEMENTATION)
+# define nvgCreate nvgCreateGL2
+# define nvgDelete nvgDeleteGL2
+#elif defined(NANOVG_GL3_IMPLEMENTATION)
+# define nvgCreate nvgCreateGL3
+# define nvgDelete nvgDeleteGL3
+#elif defined(NANOVG_GLES2_IMPLEMENTATION)
+# define nvgCreate nvgCreateGLES2
+# define nvgDelete nvgDeleteGLES2
+#elif defined(NANOVG_GLES3_IMPLEMENTATION)
+# define nvgCreate nvgCreateGLES3
+# define nvgDelete nvgDeleteGLES3
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ 523,15 538,11 @@ lv2_canvas_render(LV2_Canvas *canvas, NVGcontext *ctx, const LV2_Atom_Tuple *tup
nvgSave(ctx);
// clear surface
- /* FIXME
- cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR);
- cairo_paint(ctx);
- */
-
- // default attributes
- /* FIXME
- cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
- */
+ nvgBeginPath(ctx);
+ nvgRect(ctx, 0, 0, 1.f, 1.f);
+ nvgFillColor(ctx, nvgRGBA(0x1e, 0x1e, 0x1e, 0xff));
+ nvgFill(ctx);
+
nvgFontSize(ctx, 0.1);
nvgStrokeWidth(ctx, 0.01);
nvgStrokeColor(ctx, nvgRGBA(0xff, 0xff, 0xff, 0xff));
@@ 559,12 570,6 @@ lv2_canvas_render(LV2_Canvas *canvas, NVGcontext *ctx, const LV2_Atom_Tuple *tup
// save state
nvgRestore(ctx);
- // flush
- /* FIXME
- cairo_surface_t *surface = cairo_get_target(ctx);
- cairo_surface_flush(surface);
- */
-
return true;
}