From d9808ceffbc2e0c21fc0dc1f4fc2fd8b547a086e Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 31 Oct 2022 16:41:16 +0000 Subject: [PATCH] Ensure we do not use GL1 calls in GL3 mode --- dgl/src/pugl.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp index 001d757d..a527d016 100644 --- a/dgl/src/pugl.cpp +++ b/dgl/src/pugl.cpp @@ -44,9 +44,6 @@ # ifdef DGL_CAIRO # include # endif -# ifdef DGL_OPENGL -# include -# endif # ifdef DGL_VULKAN # import # include @@ -406,12 +403,12 @@ PuglStatus puglSetSizeAndDefault(PuglView* view, uint width, uint height) void puglOnDisplayPrepare(PuglView*) { -#ifdef DGL_OPENGL + #ifdef DGL_OPENGL glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -# ifndef DGL_USE_GLES + #ifndef DGL_USE_OPENGL3 glLoadIdentity(); -# endif -#endif + #endif + #endif } // -------------------------------------------------------------------------------------------------------------------- @@ -419,24 +416,24 @@ void puglOnDisplayPrepare(PuglView*) void puglFallbackOnResize(PuglView* const view) { -#ifdef DGL_OPENGL + #ifdef DGL_OPENGL glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -# ifndef DGL_USE_GLES + #ifdef DGL_USE_OPENGL3 + glViewport(0, 0, static_cast(view->frame.width), static_cast(view->frame.height)); + #else glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, static_cast(view->frame.width), static_cast(view->frame.height), 0.0, 0.0, 1.0); glViewport(0, 0, static_cast(view->frame.width), static_cast(view->frame.height)); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); -# else - glViewport(0, 0, static_cast(view->frame.width), static_cast(view->frame.height)); -# endif -#else + #endif + #else return; // unused (void)view; -#endif + #endif } // --------------------------------------------------------------------------------------------------------------------