From fea3ea1ab0517348f378d4e146b41ae9489c294b Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Wed, 27 Dec 2023 17:07:58 +0100 Subject: [PATCH] Refactor WantsOpenGl struct --- pixmappresenter.d | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pixmappresenter.d b/pixmappresenter.d index c4bf41d..3090582 100644 --- a/pixmappresenter.d +++ b/pixmappresenter.d @@ -435,9 +435,16 @@ struct PresenterObjects { /// struct WantsOpenGl { - bool wanted; /// Is OpenGL wanted? - ubyte vMaj; /// major version - ubyte vMin; /// minor version + ubyte vMaj; /// Major version + ubyte vMin; /// Minor version + bool compat; /// Compatibility profile? → true = Compatibility Profile; false = Core Profile + +@safe pure nothrow @nogc: + + /// Is OpenGL wanted? + bool wanted() const { + return vMaj > 0; + } } /// @@ -507,7 +514,7 @@ final class OpenGl3PixmapRenderer : PixmapRenderer { } public WantsOpenGl wantsOpenGl() @safe pure nothrow @nogc { - return WantsOpenGl(true, 3, 0); + return WantsOpenGl(3, 0, false); } // TODO: make this ctor? @@ -779,7 +786,7 @@ final class PixmapPresenter { const openGl = _renderer.wantsOpenGl; if (openGl.wanted) { setOpenGLContextVersion(openGl.vMaj, openGl.vMin); - openGLContextCompatible = false; + openGLContextCompatible = openGl.compat; openGlOptions = OpenGlOptions.yes; }