Switch back to using NanoVG UI

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-11-04 10:49:34 +00:00
parent 9b4781cb26
commit 0c916ae619
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
4 changed files with 6 additions and 10 deletions

View file

@ -27,6 +27,7 @@
#else
#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
#define DISTRHO_UI_USE_NANOVG 1
#define DISTRHO_UI_USER_RESIZABLE 1
#endif
#define DISTRHO_PLUGIN_NUM_INPUTS 2

View file

@ -27,6 +27,7 @@
#else
#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
#define DISTRHO_UI_USE_NANOVG 1
#define DISTRHO_UI_USER_RESIZABLE 1
#endif
#define DISTRHO_PLUGIN_IS_SYNTH 1

View file

@ -136,7 +136,7 @@ public:
rack::contextSet(nullptr);
}
void onDisplay() override
void onNanoDisplay() override
{
const ScopedContext sc(this);
fContext->window->step();

View file

@ -206,13 +206,11 @@ void WindowSetPluginUI(Window* const window, DISTRHO_NAMESPACE::UI* const ui)
window->internal->size = rack::math::Vec(ui->getWidth(), ui->getHeight());
// Set up NanoVG
const int nvgFlags = NVG_ANTIALIAS;
window->internal->r_vg = ui->getContext();
#ifdef NANOVG_GLES2
window->internal->r_vg = nvgCreateSharedGLES2(nvgFlags);
window->internal->r_fbVg = nvgCreateSharedGLES2(window->internal->r_vg, nvgFlags);
window->internal->r_fbVg = nvgCreateSharedGLES2(window->internal->r_vg, NVG_ANTIALIAS);
#else
window->internal->r_vg = nvgCreateGL2(nvgFlags);
window->internal->r_fbVg = nvgCreateSharedGL2(window->internal->r_vg, nvgFlags);
window->internal->r_fbVg = nvgCreateSharedGL2(window->internal->r_vg, NVG_ANTIALIAS);
#endif
// swap contexts
@ -274,10 +272,8 @@ void WindowSetPluginUI(Window* const window, DISTRHO_NAMESPACE::UI* const ui)
}
#if defined NANOVG_GLES2
nvgDeleteGLES2(window->internal->r_vg);
nvgDeleteGLES2(window->internal->r_fbVg);
#else
nvgDeleteGL2(window->internal->r_vg);
nvgDeleteGL2(window->internal->r_fbVg);
#endif
@ -381,7 +377,6 @@ void Window::step() {
// Render scene
// Update and render
nvgBeginFrame(vg, fbWidth, fbHeight, pixelRatio);
nvgScale(vg, pixelRatio, pixelRatio);
// Draw scene
@ -393,7 +388,6 @@ void Window::step() {
glViewport(0, 0, fbWidth, fbHeight);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
nvgEndFrame(vg);
}
internal->frame++;