From d5f5e57e78b9977b0b1ac2ec223fdd4c09b4dd40 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 5 Jul 2022 16:17:48 +0100 Subject: [PATCH] Skip window screenshots and glBars module if using GLES Signed-off-by: falkTX --- plugins/Cardinal/src/ImGuiWidget.cpp | 4 ++++ plugins/plugins.cpp | 6 +++++- src/override/Window.cpp | 12 +++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/Cardinal/src/ImGuiWidget.cpp b/plugins/Cardinal/src/ImGuiWidget.cpp index 7f27a73..65d129b 100644 --- a/plugins/Cardinal/src/ImGuiWidget.cpp +++ b/plugins/Cardinal/src/ImGuiWidget.cpp @@ -456,6 +456,9 @@ void ImGuiWidget::drawFramebufferCommon(const Vec& fbSize, const float scaleFact } } +#if defined(DGL_USE_GLES2) || defined(DGL_USE_GLES3) || defined(DGL_USE_OPENGL3) + // TODO? +#else glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); @@ -464,6 +467,7 @@ void ImGuiWidget::drawFramebufferCommon(const Vec& fbSize, const float scaleFact glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); +#endif io.DisplaySize = ImVec2(box.size.x * scaleFactor, box.size.y * scaleFactor); io.DisplayFramebufferScale = ImVec2(fbSize.x / (box.size.x * scaleFactor), fbSize.y / (box.size.y * scaleFactor)); diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp index 712fa88..b38d1b6 100644 --- a/plugins/plugins.cpp +++ b/plugins/plugins.cpp @@ -890,7 +890,6 @@ static void initStatic__Cardinal() p->addModel(modelCardinalBlank); p->addModel(modelExpanderInputMIDI); p->addModel(modelExpanderOutputMIDI); - p->addModel(modelGlBars); p->addModel(modelHostAudio2); p->addModel(modelHostAudio8); p->addModel(modelHostCV); @@ -902,6 +901,11 @@ static void initStatic__Cardinal() p->addModel(modelHostParametersMap); p->addModel(modelHostTime); p->addModel(modelTextEditor); + #ifndef DGL_USE_GLES + p->addModel(modelGlBars); + #else + spl.removeModule("glBars"); + #endif #ifndef STATIC_BUILD p->addModel(modelAudioFile); p->addModel(modelCarla); diff --git a/src/override/Window.cpp b/src/override/Window.cpp index a49efdf..512fec6 100644 --- a/src/override/Window.cpp +++ b/src/override/Window.cpp @@ -157,7 +157,9 @@ struct Window::Internal { int frame = 0; int frameSwapInterval = 1; +#ifndef DGL_USE_GLES int generateScreenshotStep = kScreenshotStepNone; +#endif double monitorRefreshRate = 60.0; double frameTime = 0.0; double lastFrameDuration = 0.0; @@ -366,6 +368,7 @@ void Window::run() { } +#ifndef DGL_USE_GLES static void Window__flipBitmap(uint8_t* pixels, const int width, const int height, const int depth) { for (int y = 0; y < height / 2; y++) { const int flipY = height - y - 1; @@ -415,6 +418,7 @@ static void Window__writeImagePNG(void* context, void* data, int size) { ui->setState("screenshot", String::asBase64(data, size).buffer()); } #endif +#endif void Window::step() { @@ -453,6 +457,7 @@ void Window::step() { APP->event->handleDirty(); } +#ifndef DGL_USE_GLES // Hide menu and background if generating screenshot if (internal->generateScreenshotStep == kScreenshotStepStarted) { #ifdef CARDINAL_TRANSPARENT_SCREENSHOTS @@ -462,6 +467,7 @@ void Window::step() { internal->generateScreenshotStep = kScreenshotStepSecondPass; #endif } +#endif // Get framebuffer/window ratio int winWidth = internal->ui->getWidth(); @@ -501,6 +507,7 @@ void Window::step() { ++internal->frame; +#ifndef DGL_USE_GLES if (internal->generateScreenshotStep != kScreenshotStepNone) { ++internal->generateScreenshotStep; @@ -541,6 +548,7 @@ void Window::step() { delete[] pixels; } +#endif } @@ -586,7 +594,7 @@ void Window::setFullScreen(bool) { bool Window::isFullScreen() { -#ifdef CARDINAL_TRANSPARENT_SCREENSHOTS +#if defined(CARDINAL_TRANSPARENT_SCREENSHOTS) && !defined(DGL_USE_GLES) return internal->generateScreenshotStep != kScreenshotStepNone; #else return false; @@ -668,7 +676,9 @@ int& Window::fbCount() { void generateScreenshot() { +#ifndef DGL_USE_GLES APP->window->internal->generateScreenshotStep = kScreenshotStepStarted; +#endif }