Switch back to using NanoVG UI
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
9b4781cb26
commit
0c916ae619
4 changed files with 6 additions and 10 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#else
|
#else
|
||||||
#define DISTRHO_PLUGIN_HAS_UI 1
|
#define DISTRHO_PLUGIN_HAS_UI 1
|
||||||
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
|
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
|
||||||
|
#define DISTRHO_UI_USE_NANOVG 1
|
||||||
#define DISTRHO_UI_USER_RESIZABLE 1
|
#define DISTRHO_UI_USER_RESIZABLE 1
|
||||||
#endif
|
#endif
|
||||||
#define DISTRHO_PLUGIN_NUM_INPUTS 2
|
#define DISTRHO_PLUGIN_NUM_INPUTS 2
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#else
|
#else
|
||||||
#define DISTRHO_PLUGIN_HAS_UI 1
|
#define DISTRHO_PLUGIN_HAS_UI 1
|
||||||
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
|
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
|
||||||
|
#define DISTRHO_UI_USE_NANOVG 1
|
||||||
#define DISTRHO_UI_USER_RESIZABLE 1
|
#define DISTRHO_UI_USER_RESIZABLE 1
|
||||||
#endif
|
#endif
|
||||||
#define DISTRHO_PLUGIN_IS_SYNTH 1
|
#define DISTRHO_PLUGIN_IS_SYNTH 1
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public:
|
||||||
rack::contextSet(nullptr);
|
rack::contextSet(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDisplay() override
|
void onNanoDisplay() override
|
||||||
{
|
{
|
||||||
const ScopedContext sc(this);
|
const ScopedContext sc(this);
|
||||||
fContext->window->step();
|
fContext->window->step();
|
||||||
|
|
|
||||||
|
|
@ -206,13 +206,11 @@ void WindowSetPluginUI(Window* const window, DISTRHO_NAMESPACE::UI* const ui)
|
||||||
window->internal->size = rack::math::Vec(ui->getWidth(), ui->getHeight());
|
window->internal->size = rack::math::Vec(ui->getWidth(), ui->getHeight());
|
||||||
|
|
||||||
// Set up NanoVG
|
// Set up NanoVG
|
||||||
const int nvgFlags = NVG_ANTIALIAS;
|
window->internal->r_vg = ui->getContext();
|
||||||
#ifdef NANOVG_GLES2
|
#ifdef NANOVG_GLES2
|
||||||
window->internal->r_vg = nvgCreateSharedGLES2(nvgFlags);
|
window->internal->r_fbVg = nvgCreateSharedGLES2(window->internal->r_vg, NVG_ANTIALIAS);
|
||||||
window->internal->r_fbVg = nvgCreateSharedGLES2(window->internal->r_vg, nvgFlags);
|
|
||||||
#else
|
#else
|
||||||
window->internal->r_vg = nvgCreateGL2(nvgFlags);
|
window->internal->r_fbVg = nvgCreateSharedGL2(window->internal->r_vg, NVG_ANTIALIAS);
|
||||||
window->internal->r_fbVg = nvgCreateSharedGL2(window->internal->r_vg, nvgFlags);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// swap contexts
|
// swap contexts
|
||||||
|
|
@ -274,10 +272,8 @@ void WindowSetPluginUI(Window* const window, DISTRHO_NAMESPACE::UI* const ui)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined NANOVG_GLES2
|
#if defined NANOVG_GLES2
|
||||||
nvgDeleteGLES2(window->internal->r_vg);
|
|
||||||
nvgDeleteGLES2(window->internal->r_fbVg);
|
nvgDeleteGLES2(window->internal->r_fbVg);
|
||||||
#else
|
#else
|
||||||
nvgDeleteGL2(window->internal->r_vg);
|
|
||||||
nvgDeleteGL2(window->internal->r_fbVg);
|
nvgDeleteGL2(window->internal->r_fbVg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -381,7 +377,6 @@ void Window::step() {
|
||||||
|
|
||||||
// Render scene
|
// Render scene
|
||||||
// Update and render
|
// Update and render
|
||||||
nvgBeginFrame(vg, fbWidth, fbHeight, pixelRatio);
|
|
||||||
nvgScale(vg, pixelRatio, pixelRatio);
|
nvgScale(vg, pixelRatio, pixelRatio);
|
||||||
|
|
||||||
// Draw scene
|
// Draw scene
|
||||||
|
|
@ -393,7 +388,6 @@ void Window::step() {
|
||||||
glViewport(0, 0, fbWidth, fbHeight);
|
glViewport(0, 0, fbWidth, fbHeight);
|
||||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
nvgEndFrame(vg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal->frame++;
|
internal->frame++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue