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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user