Skip window screenshots and glBars module if using GLES

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-07-05 16:17:48 +01:00
parent 8bc997f2d3
commit d5f5e57e78
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
3 changed files with 20 additions and 2 deletions

View file

@ -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); glMatrixMode(GL_PROJECTION);
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
@ -464,6 +467,7 @@ void ImGuiWidget::drawFramebufferCommon(const Vec& fbSize, const float scaleFact
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); glPushMatrix();
glLoadIdentity(); glLoadIdentity();
#endif
io.DisplaySize = ImVec2(box.size.x * scaleFactor, box.size.y * scaleFactor); 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)); io.DisplayFramebufferScale = ImVec2(fbSize.x / (box.size.x * scaleFactor), fbSize.y / (box.size.y * scaleFactor));

View file

@ -890,7 +890,6 @@ static void initStatic__Cardinal()
p->addModel(modelCardinalBlank); p->addModel(modelCardinalBlank);
p->addModel(modelExpanderInputMIDI); p->addModel(modelExpanderInputMIDI);
p->addModel(modelExpanderOutputMIDI); p->addModel(modelExpanderOutputMIDI);
p->addModel(modelGlBars);
p->addModel(modelHostAudio2); p->addModel(modelHostAudio2);
p->addModel(modelHostAudio8); p->addModel(modelHostAudio8);
p->addModel(modelHostCV); p->addModel(modelHostCV);
@ -902,6 +901,11 @@ static void initStatic__Cardinal()
p->addModel(modelHostParametersMap); p->addModel(modelHostParametersMap);
p->addModel(modelHostTime); p->addModel(modelHostTime);
p->addModel(modelTextEditor); p->addModel(modelTextEditor);
#ifndef DGL_USE_GLES
p->addModel(modelGlBars);
#else
spl.removeModule("glBars");
#endif
#ifndef STATIC_BUILD #ifndef STATIC_BUILD
p->addModel(modelAudioFile); p->addModel(modelAudioFile);
p->addModel(modelCarla); p->addModel(modelCarla);

View file

@ -157,7 +157,9 @@ struct Window::Internal {
int frame = 0; int frame = 0;
int frameSwapInterval = 1; int frameSwapInterval = 1;
#ifndef DGL_USE_GLES
int generateScreenshotStep = kScreenshotStepNone; int generateScreenshotStep = kScreenshotStepNone;
#endif
double monitorRefreshRate = 60.0; double monitorRefreshRate = 60.0;
double frameTime = 0.0; double frameTime = 0.0;
double lastFrameDuration = 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) { static void Window__flipBitmap(uint8_t* pixels, const int width, const int height, const int depth) {
for (int y = 0; y < height / 2; y++) { for (int y = 0; y < height / 2; y++) {
const int flipY = height - y - 1; 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()); ui->setState("screenshot", String::asBase64(data, size).buffer());
} }
#endif #endif
#endif
void Window::step() { void Window::step() {
@ -453,6 +457,7 @@ void Window::step() {
APP->event->handleDirty(); APP->event->handleDirty();
} }
#ifndef DGL_USE_GLES
// Hide menu and background if generating screenshot // Hide menu and background if generating screenshot
if (internal->generateScreenshotStep == kScreenshotStepStarted) { if (internal->generateScreenshotStep == kScreenshotStepStarted) {
#ifdef CARDINAL_TRANSPARENT_SCREENSHOTS #ifdef CARDINAL_TRANSPARENT_SCREENSHOTS
@ -462,6 +467,7 @@ void Window::step() {
internal->generateScreenshotStep = kScreenshotStepSecondPass; internal->generateScreenshotStep = kScreenshotStepSecondPass;
#endif #endif
} }
#endif
// Get framebuffer/window ratio // Get framebuffer/window ratio
int winWidth = internal->ui->getWidth(); int winWidth = internal->ui->getWidth();
@ -501,6 +507,7 @@ void Window::step() {
++internal->frame; ++internal->frame;
#ifndef DGL_USE_GLES
if (internal->generateScreenshotStep != kScreenshotStepNone) { if (internal->generateScreenshotStep != kScreenshotStepNone) {
++internal->generateScreenshotStep; ++internal->generateScreenshotStep;
@ -541,6 +548,7 @@ void Window::step() {
delete[] pixels; delete[] pixels;
} }
#endif
} }
@ -586,7 +594,7 @@ void Window::setFullScreen(bool) {
bool Window::isFullScreen() { bool Window::isFullScreen() {
#ifdef CARDINAL_TRANSPARENT_SCREENSHOTS #if defined(CARDINAL_TRANSPARENT_SCREENSHOTS) && !defined(DGL_USE_GLES)
return internal->generateScreenshotStep != kScreenshotStepNone; return internal->generateScreenshotStep != kScreenshotStepNone;
#else #else
return false; return false;
@ -668,7 +676,9 @@ int& Window::fbCount() {
void generateScreenshot() { void generateScreenshot() {
#ifndef DGL_USE_GLES
APP->window->internal->generateScreenshotStep = kScreenshotStepStarted; APP->window->internal->generateScreenshotStep = kScreenshotStepStarted;
#endif
} }