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);
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));

View file

@ -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);

View file

@ -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
}