aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--canvas_ui.c26
-rw-r--r--meson.build2
3 files changed, 23 insertions, 7 deletions
diff --git a/VERSION b/VERSION
index 5d8b11a..0e1a066 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.45
+0.1.377
diff --git a/canvas_ui.c b/canvas_ui.c
index 762a719..b693a75 100644
--- a/canvas_ui.c
+++ b/canvas_ui.c
@@ -22,7 +22,6 @@
#include <lv2/lv2plug.in/ns/ext/patch/patch.h>
#include <lv2/lv2plug.in/ns/extensions/ui/ui.h>
-#include <GL/glew.h>
#include <pugl/pugl.h>
#include <canvas.lv2/forge.h>
@@ -146,9 +145,12 @@ _expose(plughandle_t *handle)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
nvgBeginFrame(handle->ctx, handle->w, handle->h, 1.f);
+ nvgSave(handle->ctx);
+ nvgScale(handle->ctx, handle->w, handle->h);
lv2_canvas_render(&handle->canvas, handle->ctx, handle->graph);
+ nvgRestore(handle->ctx);
nvgEndFrame(handle->ctx);
}
@@ -373,7 +375,6 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
}
handle->control_idx = pmap->port_index(pmap->handle, "control");
- fprintf(stderr, "control_idx: %u\n", handle->control_idx);
lv2_atom_forge_init(&handle->forge, handle->map);
@@ -388,6 +389,7 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
handle->view = puglInit(NULL, NULL);
if(!handle->view)
{
+ fprintf(stderr, "puglInit failed\n");
free(handle);
return NULL;
}
@@ -409,25 +411,31 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
if(stat != 0)
{
+ fprintf(stderr, "puglCreateWindow failed\n");
puglDestroy(handle->view);
free(handle);
return NULL;
}
puglShowWindow(handle->view);
+ puglEnterContext(handle->view);
glewExperimental = GL_TRUE;
- if(glewInit() != GLEW_OK)
+ const GLenum err = glewInit();
+ if(err != GLEW_OK)
{
+ fprintf(stderr, "glewInit failed: %s\n", glewGetErrorString(err));
free(handle);
return NULL;
}
- handle->ctx = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG);
+ handle->ctx = nvgCreate(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG);
if(!handle->ctx)
{
+ fprintf(stderr, "nvgCreate failed\n");
free(handle);
return NULL;
}
+ puglLeaveContext(handle->view, false);
const intptr_t child = puglGetNativeWindow(handle->view);
*(intptr_t *)widget = child;
@@ -450,15 +458,23 @@ cleanup(LV2UI_Handle instance)
plughandle_t *handle = instance;
if(handle->graph)
+ {
free(handle->graph);
+ }
if(handle->ctx)
- nvgDeleteGL3(handle->ctx);
+ {
+ puglEnterContext(handle->view);
+ nvgDelete(handle->ctx);
+ puglLeaveContext(handle->view, false);
+ }
if(handle->view)
{
if(puglGetVisible(handle->view))
+ {
puglHideWindow(handle->view);
+ }
puglDestroy(handle->view);
}
diff --git a/meson.build b/meson.build
index c12e1e8..0966749 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,7 @@ ui_deps = [m_dep, lv2_dep]
pugl_inc = include_directories('pugl')
nanovg_inc = include_directories('nanovg/src')
-canvas_inc = include_directories('canvas.lv2.new')
+canvas_inc = include_directories('canvas.lv2')
ardour_inc = include_directories('ardour.lv2')
inc_dir = [pugl_inc, nanovg_inc, canvas_inc, ardour_inc]