1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-01-23 01:16:10 +00:00

Qt: use OpenGL ES elsewhere than on Apple.

This commit is contained in:
Thomas Harte
2025-12-17 04:34:03 +00:00
parent 66d0cfccf3
commit f097eb62ae
2 changed files with 12 additions and 1 deletions

View File

@@ -8,10 +8,17 @@ int main(int argc, char *argv[])
// QApplication instance is mandatory on some platforms ... when an
// OpenGL core profile context is requested."
QSurfaceFormat format;
#ifndef APPLE
format.setVersion(3, 0);
format.setRenderableType(QSurfaceFormat::RenderableType::OpenGLES);
#else
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
#endif
format.setDepthBufferSize(0);
format.setStencilBufferSize(0);
format.setAlphaBufferSize(0);
QSurfaceFormat::setDefaultFormat(format);
QApplication a(argc, argv);

View File

@@ -58,7 +58,11 @@ void ScanTargetWidget::paintGL() {
if(producer) {
isConnected = true;
framebuffer = defaultFramebufferObject();
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(Outputs::Display::OpenGL::API::OpenGL32Core, framebuffer);
const auto api = format().renderableType() == QSurfaceFormat::RenderableType::OpenGLES ?
Outputs::Display::OpenGL::API::OpenGLES3 : Outputs::Display::OpenGL::API::OpenGL32Core;
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(api, framebuffer);
producer->set_scan_target(scanTarget.get());
producer = nullptr;
}